PHPackages                             spinen/laravel-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. [API Development](/categories/api)
4. /
5. spinen/laravel-version

ActiveLibrary[API Development](/categories/api)

spinen/laravel-version
======================

Helpers to keep track of the version of your Laravel application.

1.9.0(1mo ago)822.6k↓42.3%1MITPHPPHP ^8.3CI passing

Since Feb 23Pushed 1mo ago8 watchersCompare

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

READMEChangelog (1)Dependencies (23)Versions (23)Used By (1)

SPINEN's Laravel Version
========================

[](#spinens-laravel-version)

[![Latest Stable Version](https://camo.githubusercontent.com/6641eea84d358f1049bfef581db083c9b23a57d5f7dad4d6a707d109342a8d63/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f6c61726176656c2d76657273696f6e2f762f737461626c65)](https://packagist.org/packages/spinen/laravel-version)[![Latest Unstable Version](https://camo.githubusercontent.com/57d11f4505ef1e2fd78845300e1fd3fa4f6d3376c3230da334c48ef6da1f9195/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f6c61726176656c2d76657273696f6e2f762f756e737461626c65)](https://packagist.org/packages/spinen/laravel-version)[![Total Downloads](https://camo.githubusercontent.com/473dcdad75f4d83625a5198105a00e60cc3ca79d13c47be5b2ba7b38ea837a37/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f6c61726176656c2d76657273696f6e2f646f776e6c6f616473)](https://packagist.org/packages/spinen/laravel-version)[![License](https://camo.githubusercontent.com/2bc4dfe55a6ee9fb47f776fcb88709242db0d3f6b5c5bbb5051f180b65c6603c/68747470733a2f2f706f7365722e707567782e6f72672f7370696e656e2f6c61726176656c2d76657273696f6e2f6c6963656e7365)](https://packagist.org/packages/spinen/laravel-version)

There are many times that it is nice to know the version of your application. At [Spinen](https://spinen.com), we adhere to [Semantic Versioning](https://semver.org) for our applications using [git-flow](https://github.com/nvie/gitflow). We keep a file in the root of our projects named `VERSION` with the current version. The CI/CD process modifies the `VERSION` file to append meaningful data. Then in the views we display the version like this ``. Additionally, we have a smokescreen test to hit a `/version` route to make sure that the expected version of the site is running.

Build Status
------------

[](#build-status)

BranchStatusCoverageCode QualityDevelop[![Build Status](https://github.com/spinen/laravel-version/workflows/CI/badge.svg?branch=develop)](https://github.com/spinen/laravel-version/workflows/CI/badge.svg?branch=develop)[![Code Coverage](https://camo.githubusercontent.com/0b7e37235eee189b3c619f2abc675eb0cf6098590825a37dbc1c15e9a174a2dc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f6c61726176656c2d76657273696f6e2f6261646765732f636f7665726167652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/spinen/laravel-version/?branch=develop)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5011e15a889b21d750f84c3e978bdcd0c6b69fb8592c14b2cf308c0731976a35/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f6c61726176656c2d76657273696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/spinen/laravel-version/?branch=develop)Master[![Build Status](https://github.com/spinen/laravel-version/workflows/CI/badge.svg?branch=master)](https://github.com/spinen/laravel-version/workflows/CI/badge.svg?branch=master)[![Code Coverage](https://camo.githubusercontent.com/a4eb76226044368e1c6082814d7ba86b5369ebaca019c5db4ce350eb28391199/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f6c61726176656c2d76657273696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinen/laravel-version/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/431002265c0b4aa745265177eba1e55a2a0f69f819b426722d00fa4ac506a970/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e656e2f6c61726176656c2d76657273696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinen/laravel-version/?branch=master)Prerequisite
------------

[](#prerequisite)

As side from Laravel &gt;= 8, there are no packages that are required.

Install
-------

[](#install)

Install Version:

```
$ composer require spinen/laravel-version
```

The package uses the [auto registration feature](https://laravel.com/docs/5.8/packages#package-discovery) of Laravel 5.

Description of version file
---------------------------

[](#description-of-version-file)

You need a file, with the Semantic Version of your application. For example...

```
4.3.6

```

Then you can add additional data either manually or via your CI/CD pipeline to be similar to this...

```
4.3.6

feature/some_great_thing
sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0
build:11425
20190220170058+0000

```

Breakdown of the line of the file

LineContentSourcePurpose14.3.6Original content in the `VERSION` fileSplit on `.` to get `major`, `minor`, `patch`2"\\n"(Optional) New lineReadability3feature/some\_great\_thingName of branchBecomes the `pre_release`4sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0Git commit SHAPart of `meta`5build:11425Build numberPart of `meta`620190220170058+0000Datetime stamp of buildPart of `meta`Some notes about the file...

- We assume that the first line is only `major`.`minor`.`patch`
- The first non-empty line after the version will become the `pre_release`
- If `pre_release` is `master`, then it gets ignored
- All of the lines after the line being used as the `pre_release` get concatenated together with a `.` to become the `meta`, so there can be as many lines as you would like

Using the package
-----------------

[](#using-the-package)

The `Spinen\Version\Version` object loads the configured version file to parse the file into the following public properties on the object...

PropertyExamplesemver4.3.6-feature/some\_great\_thing+sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0.build:11425.20190220170058+0000version4.3.6major4minor3patch6pre\_releasefeature/some\_great\_thingmetasha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0.build:11425.20190220170058+0000You can inject `Spinen\Version\Version` into your code to gain access to the properties. For our use, here are 3 main uses of the package...

1. `$version` variable in views
2. `/version` route
3. `version` commands

#### Variable in views

[](#variable-in-views)

An instance of `\Spinen\Version\Version` is added to to all views as the `$version` variable. You can do things like...

- Add version to HTML Header
    - `` to get ``
    - NOTE: Casting object to string is the same as `$version->semver`
- Add version to footer of page
    - `{{ $version->version }}` to get `4.3.6`

#### Route

[](#route)

Visiting `/version` will return the version...

```
$ curl https://localhost/version
4.3.6-feature/some_great_thing+sha:3c40a5b0d0a07973bd117a39b53367c9ff4d4cc0.build:11425.20190220170058+0000
```

#### Commands

[](#commands)

The following `artisan` commands are added...

CommandDescriptionversionDisplay full version of the application.version:majorDisplay major version of the application.version:metaDisplay meta version of the application.version:minorDisplay minor version of the application.version:patchDisplay patch version of the application.version:pre\_releaseDisplay pre\_release version of the application.version:semverDisplay semver version of the application.Configuration
-------------

[](#configuration)

Publish the package config file to `config/version.php`:

```
$ php artisan vendor:publish --tag version-config
```

This file is fully documented. You will need to make the changes to that file to suit your needs. There are 3 main configuration items...

1. `file` - Name of the file that has the version
2. `route` - Configuration of the route to display the version
3. `view` - Configuration of the view composer to add the version to the views

Example CI to modify version file
---------------------------------

[](#example-ci-to-modify-version-file)

We use [GitLab](https://about.gitlab.com), so here is a partial example `job` that we have in our `.gitlab-ci.yml`...

```
version:
  stage: build

  image: php7.2

  dependencies: []

  script:
    - echo "" >> VERSION
    - echo "${CI_COMMIT_REF_NAME}" >> VERSION
    - echo "sha:${CI_COMMIT_SHA}" >> VERSION
    - echo "build:${CI_PIPELINE_ID}" >> VERSION
    - date +"%Y%m%d%k%M%S%z" >> VERSION

  artifacts:
    name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}-version"
    paths:
      - VERSION
    expire_in: 3 days
```

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 69.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 ~172 days

Recently: every ~277 days

Total

16

Last Release

53d ago

PHP version history (3 changes)1.0.0PHP &gt;=7.2

1.5.0PHP ^8.1

1.9.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/782b3ad6f100c625875d6a8f00222d0e08e0c6f0956ef757e43a38441594c013?d=identicon)[jimmypuckett](/maintainers/jimmypuckett)

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

---

Top Contributors

[![jimmypuckett](https://avatars.githubusercontent.com/u/3220069?v=4)](https://github.com/jimmypuckett "jimmypuckett (93 commits)")[![ssfinney](https://avatars.githubusercontent.com/u/1596394?v=4)](https://github.com/ssfinney "ssfinney (39 commits)")[![drew-norvell](https://avatars.githubusercontent.com/u/67644552?v=4)](https://github.com/drew-norvell "drew-norvell (1 commits)")

---

Tags

apiapi-clientclientlaravelsemanticspinenversionlaravellibraryversionspinen

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/folio

Page based routing for Laravel.

608453.9k27](/packages/laravel-folio)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

74310.9M66](/packages/laravel-mcp)

PHPackages © 2026

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