Helpers around Git Tag versions these include getting the latest version and getting the date of the version.
Pull in the composer package by running the command below:
composer require oliveris/git-version
Import the namspace into the class (autoloading)
use GitVersion\GitVersion
Below is an example that returns a string of the git version.
GitVersion::getLatestVersion()
Below is an example that returns a date string the passed version tag was created at. The optional second parameter is a date format you need it to return as.
// Get the version you require
$git_version = GitVersion::getLatestVersion()
// Get the date for that version
GitVersion::getVersionDate($git_version, 'd-m-Y')
To run the tests set up the package in an environment you can run php and open tests/index.php
- PHP
We use Semantic Versioning 1.0.0, for example v1.0.0.
- Sam Oliveri - Software Developer
GIT Version is open-sourced software licensed under the MIT license.