mathewparet / laravel-git-version
Get the application version using git or a fallback
    v1.0.6
    2023-12-14 10:32 UTC
This package is auto-updated.
Last update: 2025-10-14 14:18:35 UTC
README
Get version number from git or fallback
Installation
composer require mathewparet/laravel-git-version
sail artisan vendor:publish --tag=laravel-git-version
Usage
To get the application version:
// config/git.php
use mathewparet\LaravelGitVersion\Git\GitVersion;
/**
 * Example #1 - get version from git,
 * or fallback and read the contents of the 
 * `.current_version` file in the application 
 * root.
 */
'version' => GitVersion::version();
/**
 * Example #2 - get version from git,
 * or fallback and run the closure.
 */
'version' => GitVersion::version(function() {
    return env('APP_VERSION');
});