PHPackages                             tremby/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. tremby/laravel-git-version

ActiveLibrary

tremby/laravel-git-version
==========================

A helper to get the current git version of the application

v1.2.2(6y ago)62629.0k↓22.7%13[1 issues](https://github.com/tremby/laravel-git-version/issues)3MITPHP

Since Jun 19Pushed 5y ago3 watchersCompare

[ Source](https://github.com/tremby/laravel-git-version)[ Packagist](https://packagist.org/packages/tremby/laravel-git-version)[ RSS](/packages/tremby-laravel-git-version/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (3)

Laravel/Lumen project git version getter
========================================

[](#laravellumen-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.

Framework version
-----------------

[](#framework-version)

This package works with both Laravel 4 and 5, and also Lumen.

Installation
------------

[](#installation)

Require it in your Laravel/Lumen project:

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

```

### Optional packages

[](#optional-packages)

This module uses [Symfony's Process component](https://github.com/symfony/process) if available, or falls back to `shell_exec` otherwise. So if your deployment environment has `shell_exec` disabled, you can work around this by installing `symfony/process`.

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()

```

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`.

### 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.

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.

To use this, install the service provider by adding it to your `config/app.php`file:

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

```

Then the view is available:

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

```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~292 days

Recently: every ~417 days

Total

7

Last Release

2230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0369334bd5956ec9b5cf3262d671bef2d24b642e6a22ff153308bb1d0eb128c5?d=identicon)[tremby](/maintainers/tremby)

---

Top Contributors

[![tremby](https://avatars.githubusercontent.com/u/199635?v=4)](https://github.com/tremby "tremby (10 commits)")[![stephandesouza](https://avatars.githubusercontent.com/u/159077?v=4)](https://github.com/stephandesouza "stephandesouza (2 commits)")[![ngugijames](https://avatars.githubusercontent.com/u/6430405?v=4)](https://github.com/ngugijames "ngugijames (1 commits)")

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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