Versioning your Laravel Project
Create a string which pulls information from your Git history

Create a version.php config file
Tagging releases



Last updated
Create a string which pulls information from your Git history




Last updated
<?php
$tag = exec('git describe --tags --abbrev=0');
if(empty($tag)) {
$tag = '-.-.-';
}
$hash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$date = Carbon\Carbon::parse(trim(exec('git log -n1 --pretty=%ci HEAD')));
return [
'tag' => $tag,
'date' => $date,
'hash' => $hash,
'string' => sprintf('%s-%s (%s)',$tag, $hash, $date->format('d/m/y H:i')),
];