PHPackages                             ballen/git-version-number - 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. ballen/git-version-number

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

ballen/git-version-number
=========================

A simple class for utilising your project's Git version information as your application version.

2.0.5(3y ago)0142[1 issues](https://github.com/allebb/git-version-number/issues)[1 PRs](https://github.com/allebb/git-version-number/pulls)MITPHPPHP &gt;=7.3.0CI passing

Since Dec 3Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/allebb/git-version-number)[ Packagist](https://packagist.org/packages/ballen/git-version-number)[ RSS](/packages/ballen-git-version-number/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (9)Dependencies (2)Versions (11)Used By (0)

Git Version Number
==================

[](#git-version-number)

[![Build](https://github.com/allebb/git-version-number/workflows/build/badge.svg)](https://github.com/allebb/git-version-number/actions)[![Code Coverage](https://camo.githubusercontent.com/2a5c14912862efad294d9c3055e4267fb90e5097c3d34b0dbcf55de9abfadaf4/68747470733a2f2f636f6465636f762e696f2f67682f616c6c6562622f6769742d76657273696f6e2d6e756d6265722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/allebb/git-version-number)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bd96efe944dc24136004154e6d1344dd7494473f6b6f5707c6576fcf59a7c094/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c6c6562622f6769742d76657273696f6e2d6e756d6265722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/allebb/git-version-number/?branch=master)[![Code Climate](https://camo.githubusercontent.com/372dab595839e648b488093ac723aeae8f715a67ba614452a1be6d8dd51b0c62/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f616c6c6562622f6769742d76657273696f6e2d6e756d6265722f6261646765732f6770612e737667)](https://codeclimate.com/github/allebb/git-version-number)[![Latest Stable Version](https://camo.githubusercontent.com/dc44b996027273d9552f222495d32a5cfc7a713352cb7aad4b5dab723c3d5fb6/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f6769742d76657273696f6e2d6e756d6265722f762f737461626c65)](https://packagist.org/packages/ballen/git-version-number)[![Latest Unstable Version](https://camo.githubusercontent.com/461891049cbb7b79814d4abb58d148acf05c3c6404f4befa68d9cf1bdcf84d7e/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f6769742d76657273696f6e2d6e756d6265722f762f756e737461626c65)](https://packagist.org/packages/ballen/git-version-number)[![License](https://camo.githubusercontent.com/5f128a3d686466b09e6232e385be7e3edab3b8437e3c66162c47907e78ea2ad0/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f6769742d76657273696f6e2d6e756d6265722f6c6963656e7365)](https://packagist.org/packages/ballen/git-version-number)

A simple library for utilising your project's Git version information as your application version.

Requirements
------------

[](#requirements)

This library is unit tested against PHP 7.3, 7.4, 8.0, 8.1 and 8.2!

If you need to use an older version of PHP, you should instead install the 2.x version of this library (see below for details).

License
-------

[](#license)

This library is released under the [MIT license](LICENSE).

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

[](#installation)

The recommended way of installing this library is via. [Composer](http://getcomposer.org); To install using Composer type the following command at the console:

```
composer require ballen/git-version-number
```

**If you need to use an older version of PHP, version 1.x.x supports PHP 5.6, 7.0, 7.1 and 7.2, you can install this version using Composer with this command instead:**

```
composer require ballen/git-version-number ^1.0
```

Examples
--------

[](#examples)

A set of working examples can be found in the `/examples` directory.

Tests and coverage
------------------

[](#tests-and-coverage)

This library is fully unit tested using [PHPUnit](https://phpunit.de/).

If you wish to run the tests yourself you should run the following:

```
# Install the Library with the 'development' packages this then includes PHPUnit!
composer install

# Now we run the unit tests (from the root of the project) like so:
./vendor/bin/phpunit
```

Code coverage can also be run but requires XDebug installed...

```
./vendor/bin/phpunit --coverage-html ./report
```

Support
-------

[](#support)

I am happy to provide support via. my personal email address, so if you need a hand drop me an email at: ballen@bobbyallen.me.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance50

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~368 days

Recently: every ~183 days

Total

9

Last Release

1276d ago

Major Versions

1.0.2 → 2.0.02020-12-22

PHP version history (4 changes)1.0.0PHP &gt;=5.4.0

2.0.0PHP &gt;=7.1.0

2.0.1PHP &gt;=7.2.0

2.0.2PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4729a376aa8281d9456a90c000e991aa605c96f15251469acd5a7a5c6cdde2e6?d=identicon)[allebb](/maintainers/allebb)

---

Top Contributors

[![allebb](https://avatars.githubusercontent.com/u/767628?v=4)](https://github.com/allebb "allebb (61 commits)")

---

Tags

gitapplicationversiongit versionapp-versionballenbobsta63

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ballen-git-version-number/health.svg)

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

###  Alternatives

[czproject/git-php

Library for work with Git repository in PHP.

5555.1M102](/packages/czproject-git-php)[nikolaposa/version

Value Object that represents a SemVer-compliant version number.

1397.0M21](/packages/nikolaposa-version)[marcocesarato/php-conventional-changelog

Generate changelogs and release notes from a project's commit messages and metadata and automate versioning with semver.org and conventionalcommits.org

2521.4M117](/packages/marcocesarato-php-conventional-changelog)[ramsey/conventional-commits

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.5M142](/packages/ramsey-conventional-commits)[sebastianfeldmann/git

PHP git wrapper

487.4M20](/packages/sebastianfeldmann-git)

PHPackages © 2026

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