Determine your project version from either a commit.json or from your git repository.
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.
*/