Download the PHP package mrfleshka/symfony-versioning-bundle without Composer
On this page you can find all versions of the php package mrfleshka/symfony-versioning-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mrfleshka/symfony-versioning-bundle
More information about mrfleshka/symfony-versioning-bundle
Files in mrfleshka/symfony-versioning-bundle
Package symfony-versioning-bundle
Short Description 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
License MIT
Homepage https://github.com/shivas/versioning-bundle
Informations about the package symfony-versioning-bundle
This is forked project. Author repository
versioning-bundle
Simple way to version your Symfony Flex application.
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 https://github.com/nikolaposa/version library
- Support for manual version management
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:
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
Symfony Flex automates the installation process, just require the bundle in your application!
The version is automatically available in your application.
Console commands
There are three available console commands. You only need to run the app:version:bump command when manually managing your version number.
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
It's easy, write a class that implements the ProviderInterface
:
Add the provider to the container using your services file:
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:
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
:
Creating your own version formatter
To customize the version format, write a class that implements the FormatterInterface
:
Then alias the FormatterInterface
with your own:
Capistrano v3 task for creating a REVISION file
Add following to your recipe
Good luck versioning your project.
Contributions for different SCM's and etc are welcome, just submit a pull request.
All versions of symfony-versioning-bundle with dependencies
nikolaposa/version Version ^4
symfony/console Version ^3.4 || ^4 || ^5 || ^6
symfony/framework-bundle Version ^3.4 || ^4 || ^5 || ^6
symfony/process Version ^3.4 || ^4 || ^5 || ^6