kba-team/version

Determine your project version from either a commit.json or from your git repository.

v2.0.2 2024-04-24 14:51 UTC

This package is auto-updated.

Last update: 2024-10-07 15:19:10 UTC


README

License: MIT Build Status Maintainability Test Coverage

Determine your project version from either a commit.json or from your git repository.

Usage

composer require kba-team/version

Simple usage in your PHP code:

<?php
use kbATeam\Version\Version;
use kbATeam\Version\FileVersion;
use kbATeam\Version\GitVersion;

$version = new Version();
$version->register(new FileVersion(APP.DS.'webroot'.DS.'commit.json'));
$version->register(new GitVersion(APP));
if ($version->exists()) {
    printf('%s (rev. %s)', $version->getBranch(), $version->getCommit());
}
/**
 * prints `<branch> (rev. <commit ID>)` of your CakePHP project.
 */