PHPackages                             mrfleshka/symfony-versioning-bundle - 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. mrfleshka/symfony-versioning-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

mrfleshka/symfony-versioning-bundle
===================================

Symfony application versioning, simple console command to manage version (with providers e.g. git tag) of your application using Semantic Versioning 2.0.0 recommendations

4.0.2(3y ago)011MITPHPPHP ^7.2 || ^8

Since Oct 31Pushed 3y agoCompare

[ Source](https://github.com/mrFleshka/versioning-bundle)[ Packagist](https://packagist.org/packages/mrfleshka/symfony-versioning-bundle)[ Docs](https://github.com/shivas/versioning-bundle)[ RSS](/packages/mrfleshka-symfony-versioning-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

This is forked project. [Author repository](https://github.com/shivas/versioning-bundle)
----------------------------------------------------------------------------------------

[](#this-is-forked-project-author-repository)

---

versioning-bundle
=================

[](#versioning-bundle)

[![SensioLabsInsight](https://camo.githubusercontent.com/c1d43110905c8bd59c39e4b5a2c2bc9076b5fc03a1a1fa897246f623de3cabdf/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64366437333337362d623832362d343664302d383566352d6664396637376334356330362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d6d73376-b826-46d0-85f5-fd9f77c45c06)[![Total Downloads](https://camo.githubusercontent.com/7cd8dd59af810ef226f35f3427cf61e89d38eb4a2299f05b47699268db4c545e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368697661732f76657273696f6e696e672d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/shivas/versioning-bundle)

Simple way to version your Symfony Flex application.

What it is:
-----------

[](#what-it-is)

- Automatically keep track of your application version using Git tags or a Capistrano REVISION file
- Adds a global Twig variable for easy access
- Easy to extend with new version providers and formatters for different SCM's or needs
- Uses Semantic Versioning 2.0.0 recommendations using  library
- Support for manual version management

Purpose:
--------

[](#purpose)

To have an environment variable in your Symfony application with the current version of the application for various needs:

- Display in frontend
- Display in backend
- Anything you can come up with

Providers implemented:
----------------------

[](#providers-implemented)

- `VersionProvider` (read the version from a VERSION file)
- `GitRepositoryProvider` (git tag describe provider to automatically update the version by looking at git tags)
- `RevisionProvider` (read the version from a REVISION file)
- `InitialVersionProvider` (just returns the default initial version 0.1.0)

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

[](#installation)

Symfony Flex automates the installation process, just require the bundle in your application!

```
composer require shivas/versioning-bundle
```

The version is automatically available in your application.

```
# Twig template
{{ shivas_app_version }}

# Or get the version from the service
public function indexAction(VersionManagerInterface $manager)
{
    $version = $manager->getVersion();
}

```

Console commands
----------------

[](#console-commands)

There are three available console commands. You only need to run the app:version:bump command when manually managing your version number.

```
# Display the application version status
bin/console app:version:status

# Display all available version providers
bin/console app:version:list-providers

# Manually bump the application version
bin/console app:version:bump
```

Version providers
-----------------

[](#version-providers)

Providers are used to get a version string for your application. All versions should follow the SemVer 2.0.0 notation, with the exception that letter "v" or "V" may be prefixed, e.g. v1.0.0. The recommended version provider is the `GitRepositoryProvider` which only works when you have at least one TAG in your repository. Be sure that all of your TAGS are valid version numbers.

Adding own provider
-------------------

[](#adding-own-provider)

It's easy, write a class that implements the `ProviderInterface`:

```
namespace App\Provider;

use Shivas\VersioningBundle\Provider\ProviderInterface;

class MyCustomProvider implements ProviderInterface
{

}
```

Add the provider to the container using your services file:

```
App\Provider\MyCustomProvider:
    tags:
        - { name: shivas_versioning.provider, alias: my_provider, priority: 0 }
```

```

```

Please take a look at the priority attribute, it should be between 0 and 99 to keep the providers in the right order.

Ensure your provider is loaded correctly and supported:

```
bin/console app:version:list-providers

Registered version providers
 ============= ========================================================= ========== ===========
  Alias         Class                                                     Priority   Supported
 ============= ========================================================= ========== ===========
  version       Shivas\VersioningBundle\Provider\VersionProvider          100        No
  my_provider   App\Provider\MyCustomProvider                             0          Yes
  git           Shivas\VersioningBundle\Provider\GitRepositoryProvider    -25        Yes
  revision      Shivas\VersioningBundle\Provider\RevisionProvider         -50        No
  init          Shivas\VersioningBundle\Provider\InitialVersionProvider   -75        Yes
 ============= ========================================================= ========== ===========
```

Version formatters
------------------

[](#version-formatters)

Version formatters are used to modify the version string to make it more readable. The default `GitDescribeFormatter` works in the following fashion:

- if the commit sha matches the last tag sha then the tag is converted to the version as is
- if the commit sha differs from the last tag sha then the following happens:
    - the tag is parsed as the version
    - the prerelease part is added with following data: "dev.abcdefa"
    - where the prerelease part "dev" means that the version is not tagged and is "dev" stable, and the last part is the commit sha

If you want to disable the default formatter, use the `NullFormatter`:

```
# app/config/services.yaml
Shivas\VersioningBundle\Formatter\NullFormatter: ~
Shivas\VersioningBundle\Formatter\FormatterInterface: '@Shivas\VersioningBundle\Formatter\NullFormatter'
```

Creating your own version formatter
-----------------------------------

[](#creating-your-own-version-formatter)

To customize the version format, write a class that implements the `FormatterInterface`:

```
namespace App\Formatter;

use Shivas\VersioningBundle\Formatter\FormatterInterface;

class MyCustomFormatter implements FormatterInterface
{

}
```

Then alias the `FormatterInterface` with your own:

```
# app/config/services.yaml
Shivas\VersioningBundle\Formatter\FormatterInterface: '@App\Formatter\MyCustomFormatter'
```

Capistrano v3 task for creating a REVISION file
-----------------------------------------------

[](#capistrano-v3-task-for-creating-a-revision-file)

Add following to your recipe

```
namespace :deploy do
    task :add_revision_file do
        on roles(:app) do
            within repo_path do
                execute(:git, :'describe', :"--tags --long",
                :"#{fetch(:branch)}", ">#{release_path}/REVISION")
            end
        end
    end
end

# We get git describe --tags just after deploy:updating
after 'deploy:updating', 'deploy:add_revision_file'
```

Good luck versioning your project.

Contributions for different SCM's and etc are welcome, just submit a pull request.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1287d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f608195a96dca950a484759aaaadb457a076c360286bc1e13ab5babcf40dab3?d=identicon)[mrFleshka](/maintainers/mrFleshka)

---

Top Contributors

[![shivas](https://avatars.githubusercontent.com/u/577493?v=4)](https://github.com/shivas "shivas (27 commits)")[![dontub](https://avatars.githubusercontent.com/u/5405481?v=4)](https://github.com/dontub "dontub (27 commits)")[![mrFleshka](https://avatars.githubusercontent.com/u/14197648?v=4)](https://github.com/mrFleshka "mrFleshka (2 commits)")[![wassafr](https://avatars.githubusercontent.com/u/10235180?v=4)](https://github.com/wassafr "wassafr (1 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")[![kevin-lot](https://avatars.githubusercontent.com/u/5575659?v=4)](https://github.com/kevin-lot "kevin-lot (1 commits)")[![vblinden](https://avatars.githubusercontent.com/u/1420356?v=4)](https://github.com/vblinden "vblinden (1 commits)")

---

Tags

semverversioningsemanticversion

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrfleshka-symfony-versioning-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mrfleshka-symfony-versioning-bundle/health.svg)](https://phpackages.com/packages/mrfleshka-symfony-versioning-bundle)
```

###  Alternatives

[shivas/versioning-bundle

Symfony application versioning, simple console command to manage version (with providers e.g. git tag) of your application using Semantic Versioning 2.0.0 recommendations

1121.2M1](/packages/shivas-versioning-bundle)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M565](/packages/symfony-maker-bundle)[nikolaposa/version

Value Object that represents a SemVer-compliant version number.

1406.4M16](/packages/nikolaposa-version)[pragmarx/version

Take control over your Laravel app version

5921.2M2](/packages/pragmarx-version)[naneau/semver

A decent, standards-compliant, Semantic Versioning (SemVer) parser and library

72496.2k13](/packages/naneau-semver)[z4kn4fein/php-semver

Semantic Versioning library for PHP. It implements the full semantic version 2.0.0 specification and provides ability to parse, compare, and increment semantic versions along with validation against constraints.

251.5M17](/packages/z4kn4fein-php-semver)

PHPackages © 2026

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