A Laravel package that provides easy access to Git version information for your application. This package allows you to retrieve the current Git commit hash, repository URL, and a direct link to the current commit, which can be useful for deployment tracking, debugging, and displaying version information in your application.
You can install the package via composer:
composer require connorhowell/laravel-git-version
The package will automatically register its service provider.
You can use this package in two ways: via the Facade or by directly using the class.
use ConnorHowell\LaravelGitVersion\Facades\LaravelGitVersion;
// Get all version information
$versionInfo = LaravelGitVersion::getVersionInfo();
// Returns: ['version' => 'abc123...', 'repo' => 'https://github.com/user/repo', 'commit_url' => 'https://github.com/user/repo/commit/abc123...']
// Get just the current commit hash
$commitHash = LaravelGitVersion::getCurrentGitCommitHash();
// Get the repository URL
$repoUrl = LaravelGitVersion::getGitUrl();
// Get the URL to the current commit
$commitUrl = LaravelGitVersion::getCurrentCommitUrl();
use ConnorHowell\LaravelGitVersion\LaravelGitVersion;
// Get all version information
$versionInfo = LaravelGitVersion::getVersionInfo();
// Get the URL to the current commit
$commitUrl = LaravelGitVersion::getCurrentCommitUrl();
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.