connorhowell / laravel-git-version
Retrieve current verison information about the app in the form of a git commit hash
Fund package maintenance!
Connor Howell
Requires
- php: ^8.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
README
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.
Installation
You can install the package via composer:
composer require connorhowell/laravel-git-version
The package will automatically register its service provider.
Usage
You can use this package in two ways: via the Facade or by directly using the class.
Using the Facade
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();
Direct Usage
use ConnorHowell\LaravelGitVersion\LaravelGitVersion; // Get all version information $versionInfo = LaravelGitVersion::getVersionInfo(); // Get the URL to the current commit $commitUrl = LaravelGitVersion::getCurrentCommitUrl();
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.