1. Go to this page and download the library: Download artistan/git-info library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
artistan / git-info example snippets
/**
* 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
*/
}
$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));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.