connorhowell/laravel-git-version

Retrieve current verison information about the app in the form of a git commit hash

v1.0.1 2025-07-01 11:24 UTC

This package is auto-updated.

Last update: 2025-07-01 12:02:24 UTC


README

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

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.