artistan / git-info
自动环境配置,依赖于git分支(非生产)或标签(生产)
2.0.1
2018-07-19 14:35 UTC
Requires
- php: >=5.6.4
- eiriksm/gitinfo: ^1.1
- illuminate/support: 5.*
Requires (Dev)
- phpunit/phpunit: ~5.7.21
- satooshi/php-coveralls: ^1.0
- victorjonsson/markdowndocs: 1.3.*
This package is not auto-updated.
Last update: 2024-09-15 05:22:15 UTC
README
Artistan/git-info 帮助您根据git分支或标签动态配置环境。
git-info 将创建一个配置文件,您可以使用它来链接到版本化的cdn存储库目录等动态位置。
作为简单的Php对象或作为Laravel 5.6的包工作良好。
composer
"require": { "artistan/git-info": "*" }
cli安装
composer require artistan/git-info php artisan vendor:publish --provider=artistan/git-info
示例Laravel
./app/Providers/AppServiceProvider.php
/** * Bootstrap any application services. * * @return void */ public function boot() { /** * last-cached will be null if not cached... */ if (is_null(config('cdn.last-cached'))) { config([ 'cdn.last-cached' => microtime(true), /** * This will set my path dynamically based on the tag/branch */ 'cdn.path' => config('git-info.path'), 'cdn.url' => config('cdn.uri').config('git-info.path') ]); } /** * now I can use config('cdn.url') to route to my current versioned content on my cdn */ }
示例Php
require '../vendor/autoload.php'; $git = new Artistan\GitInfo\GitInfoEnv(); // build all dynamic with var_dump($git->getConfigs('/path/[REPO]/[BRANCH]/[TAG]')) // or dig into all the options... var_dump($git->getShortHash()); var_dump($git->getVersion()); var_dump($git->getDate()); var_dump($git->getApplicationVersionString()); var_dump($repo = $git->getRepo()); var_dump($branch = $git->getBranch()); var_dump($tag = $git->getLatestTag()); // null coalesce allows $tag to failover to $branch if it is null var_dump($path = $git->buildPath($repo,$branch,$tag??$branch,null));
最终将得到 /path/branchName
或 /path/{v#.#.#}
文档 更新
PHP-Markdown-Documentation-Generator
./vendor/bin/phpdoc-md generate --ignore=test,examples src > api.md