kba-team/version

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

1.1.0 2020-01-27 13:15 UTC

This package is auto-updated.

Last update: 2022-07-27 18:57:27 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.
 */