Skip to content

Instantly share code, notes, and snippets.

@mikehins
Created December 15, 2023 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikehins/f2ebacbceb098a6e9197df95dad0dbee to your computer and use it in GitHub Desktop.
Save mikehins/f2ebacbceb098a6e9197df95dad0dbee to your computer and use it in GitHub Desktop.
Add application version to Laravel app
// AppServiceProvider
public function boot(): void
{
//...
Blade::directive('rev', function () {
$v = config('app.version');
$b = exec('git rev-parse --short HEAD');
return ($v ? 'Version ' . $v : '') . ($b ? '<br>Build ' . $b : '');
});
//...
// footer.blade.php
<footer>@rev</footer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment