PHPackages                             okaufmann/laravel-git-version - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. okaufmann/laravel-git-version

AbandonedArchivedPackage[Utility &amp; Helpers](/categories/utility)

okaufmann/laravel-git-version
=============================

A helper to get the current git version of the application

1.1.5(8y ago)01.2kMITPHP

Since Jun 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/okaufmann/laravel-git-version)[ Packagist](https://packagist.org/packages/okaufmann/laravel-git-version)[ RSS](/packages/okaufmann-laravel-git-version/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (9)Used By (0)

Laravel project git version getter
----------------------------------

[](#laravel-project-git-version-getter)

A helper class to get the current git version of the project.

Expects either a `version` file to exist in the `base_path()` of your project containing a version string, or the `git` binary to be available.

**This is my own for to match my needs**Originally initiated by [@tremby](https://github.com/tremby/laravel-git-version)Consider contribute to his version.

Laravel version
---------------

[](#laravel-version)

This package works with both Laravel 4 and 5.

### Installation

[](#installation)

Require it in your Laravel project:

```
composer require okaufmann/laravel-git-version

```

Install the service provider by adding it to your `config/app.php`file:

```
'providers' => [
    ...
    Tremby\LaravelGitVersion\GitVersionServiceProvider::class,
],

```

### Use

[](#use)

You can get the git version string with

```
\Tremby\LaravelGitVersion\GitVersionHelper::getVersion()

```

Or you can get your app name and version number such as `my-project/1.0` with

```
\Tremby\LaravelGitVersion\GitVersionHelper::getNameAndVersion()

```

Also, you can get the latest commit hash by calling this method:

```
\Tremby\LaravelGitVersion\GitVersionHelper::getHash(8)

```

`getHash()` method gets an integer which is the length of commit hash. If it's null, `getHash()` returns full width.

The app's name is taken from `Config::get('app.name', 'app')`, so you can configure it in your `config/app.php` file or leave it as the default of `app`.

#### Command

[](#command)

On releasing a new version of you app run the following commands to tag a new version and create a file with the correct version info:

```
git tag v0.0.3
php artisan version:bump

```

#### View

[](#view)

A view is provided which just outputs an HTML comment with the return value of `getNameAndVersion()`. I like to include this in the main layout template of the project.

The view is available:

```
@include('git-version::version-comment')

```

Recommended usage pattern
-------------------------

[](#recommended-usage-pattern)

Ensure your git tags are pushed to your servers so that the versions are described properly.

During development and possibly in staging environments allow the version to be determined automatically (this is done via `git describe`).

As part of your production deployment procedure, write a `version` file (perhaps via a command like `git describe --always --tags --dirty >version`, since this is the command this package would run otherwise). When this `version` file exists the package will use its contents rather than executing `git`, saving some processor and IO time.

Add `/version` to your `.gitignore` file so your working tree stays clean and you don't accidentally commit it.

Or you commit it and let the application use the version from the file (e.g. you just bump tags)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 52% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~65 days

Total

8

Last Release

3199d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac14ae1d966d2e64dc0eafb28a747b95e34069e1ddeabfcd5d6709569f4e9b19?d=identicon)[okaufmann](/maintainers/okaufmann)

---

Top Contributors

[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (13 commits)")[![mhipo1364](https://avatars.githubusercontent.com/u/1858512?v=4)](https://github.com/mhipo1364 "mhipo1364 (7 commits)")[![tremby](https://avatars.githubusercontent.com/u/199635?v=4)](https://github.com/tremby "tremby (5 commits)")

### Embed Badge

![Health badge](/badges/okaufmann-laravel-git-version/health.svg)

```
[![Health](https://phpackages.com/badges/okaufmann-laravel-git-version/health.svg)](https://phpackages.com/packages/okaufmann-laravel-git-version)
```

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

591.7k1](/packages/crumbls-layup)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
