mathewparet/laravel-git-version

使用 git 获取应用程序版本或回退机制

v1.0.6 2023-12-14 10:32 UTC

This package is auto-updated.

Last update: 2024-09-14 12:04:10 UTC


README

从 git 获取版本号或回退

安装

composer require mathewparet/laravel-git-version
sail artisan vendor:publish --tag=laravel-git-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');
});