PHP code example of kba-team / version

1. Go to this page and download the library: Download kba-team/version library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kba-team / version example snippets



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.
 */