m-tech-org / laravel-gitstamp
Deploy-time git commit/date stamping for Laravel apps with no build pipeline — know what's actually running in production without SSHing in.
Requires
- php: ^8.1
- illuminate/console: ^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
- symfony/process: ^6.0|^7.0
Requires (Dev)
- larastan/larastan: ^2.9|^3.0
- laravel/pint: ^1.13
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
README
Know what's actually running in production, without SSHing in and running git log.
laravel-gitstamp generates a version stamp (date + short git SHA, e.g. 2026.07.18-6601bf7)
once at deploy time and gives you a helper, a facade, and a Blade component to display it anywhere in your app — no git
tags, no manual version bumping, no shelling out to git on every request.
See ABOUT.md for the problem this solves and the reasoning behind the design.
Requirements
| laravel-gitstamp | PHP | Laravel |
|---|---|---|
| ^1.0 | ^8.1 | 9.x – 12.x |
Laravel 10–12 are covered by CI. Laravel 9 is supported at runtime (nothing in this package's code is version-specific) but isn't covered by automated CI — Pest has never shipped a release compatible with the PHPUnit version Laravel 9's test tooling pins to. See CONTRIBUTING.md for details.
Installation
composer require m-tech-org/laravel-gitstamp
The package auto-registers its service provider and Gitstamp facade via Laravel package discovery — no manual
registration needed.
Optionally publish the config file:
php artisan vendor:publish --tag=gitstamp-config
Usage
1. Generate the stamp at deploy time
Run this once per deploy, in the app's working directory (a real git checkout):
git pull origin develop php artisan gitstamp:generate composer install --no-dev --optimize-autoloader --no-interaction php artisan migrate --force
This writes a value like 2026.07.18-6601bf7 to storage/app/gitstamp.txt (configurable). It never fails the deploy —
if .git isn't present or git isn't on $PATH, it falls back to a configurable default ('dev' by default) instead
of throwing.
Skip this step in local/dev environments; gitstamp() will simply return the fallback value.
2. Display it
Helper:
<div class="float-right d-none d-sm-inline-block"> <b>Version</b> {{ gitstamp() }} </div>
Facade:
use MTechOrg\Gitstamp\Facades\Gitstamp; Gitstamp::current(); // "2026.07.18-6601bf7"
Blade component:
<x-gitstamp::badge class="float-right d-none d-sm-inline-block" />
The component renders minimal markup (Version {{ ... }}) and forwards any attributes you pass it — styling and
placement are up to your app's theme.
Configuration
// config/gitstamp.php return [ 'path' => storage_path('app/gitstamp.txt'), 'date_format' => 'Y.m.d', 'format' => '%s-%s', // sprintf(format, date, short_sha) 'fallback' => 'dev', ];
Testing
composer install composer test composer format # Pint, code style composer analyse # PHPStan / Larastan, static analysis
Changelog
See CHANGELOG.md for a history of changes.
Contributing
See CONTRIBUTING.md.
Security
If you discover a security issue, please open an issue on GitHub rather than a public PR with exploit details.
Credits
See CREDITS.md.
License
The MIT License (MIT). See LICENSE.md for details.