juliendufresne / composer-version-handler
Composer script to automates the process of updating an application version number
Installs: 5 553
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/juliendufresne/composer-version-handler
Requires
- php: >=7.0
- symfony/process: ~2.3|~3.0
- symfony/yaml: ~2.3|~3.0
Requires (Dev)
- composer/composer: ^1.0
This package is not auto-updated.
Last update: 2025-03-01 21:06:37 UTC
README
Usage
Add the following in your root composer.json file:
{
"require": {
"juliendufresne/composer-version-handler": "^1.0"
},
"scripts": {
"post-install-cmd": [
"JulienDufresne\\VersionHandler\\ScriptHandler::updateVersion"
],
"post-update-cmd": [
"JulienDufresne\\VersionHandler\\ScriptHandler::updateVersion"
]
},
"extra": {
"juliendufresne-version": {
"file": "app/config/parameters.yml",
"parameter-key": "parameters.app_version",
"strategies": ["git", "incremental"]
}
}
}
The parameters.app_version will then be updated according to the first strategy able to deliver a version number.
Strategies
Git
If the current revision corresponds to a git tag, the git strategy will use this tag as a version.
Incremental
The incremental strategy increment the version by 1. This strategy requires the version to end with a number. If there is no current version, the next version is set to 1.
Ex: if the current version is v10, then this strategy will set the new version to v12