Download the PHP package stolt/version-aligner without Composer
On this page you can find all versions of the php package stolt/version-aligner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package version-aligner
version-aligner
A small development tool to keep application versions aligned with Git tags and changelog entries.
The version-aligner works particularly well with standardized PHP package structures such as those defined by
pds/skeleton.
Why?
Releases can have more than one version source.
For example, a CLI application might have its version defined in the application itself, while the release version is
represented by a Git tag and documented in CHANGELOG.md.
It is easy to update the Git tag and changelog while forgetting to bump the version in the application.
That has happened to me several times.
The result is a release where the repository says one thing, while the application reports another:
version-aligner exists to catch exactly this kind of inconsistency.
It checks whether your application's version matches the release version represented by Git and CHANGELOG.md before an
outdated version reaches your users.
What it checks
version-aligner compares:
- the latest Git tag
- the latest version in
CHANGELOG.md - the version set in the application
All three versions must refer to the same release.
Installation
The version-aligner CLI can be installed through Composer.
Available commands
Check command
check compares the application's version with the latest Git tag and the latest CHANGELOG.md entry.
You can use it in pre-commit Git hooks, Composer scripts, or continuous integration workflows.
Example Composer script:
Evaluable outcomes of the check command are:
| Scenario | Expected behavior |
|---|---|
| All versions match | Exit 0 |
| Version mismatch | Non-zero exit |
| Required source missing | Clear diagnostic and non-zero exit |
| Git metadata unavailable | Clear diagnostic and non-zero exit |
Align command
align updates the application version when it differs from the release version.
Version discovery
version-aligner automatically discovers the application version without requiring configuration.
It checks the following PHP files for a version string (1.2.3 or v1.2.3), in order:
- Executable files declared in
composer.json'sbinsection. src/Console/Application.phpsrc/Application.phpsrc/Server.php
The first matching version string is used as the application's version. If no version is found, discovery returns
null.
License
This library and its CLI are licensed under the MIT license. Please see LICENSE.md for more details.
Changelog
All noteworthy changes are documented in the CHANGELOG.md.
Reporting issues
Found a bug or an unexpected version alignment result? Please open an issue.
If version discovery fails or detects an incorrect version, include:
- The expected and detected application versions.
- The relevant
composer.jsonand PHP file structure. - The output of the command you ran.
- Steps to reproduce the issue.
Please remove any sensitive information before sharing files or command output.
Contributing
If you're considering contributing to this project, have a look at this repository's CONTRIBUTING.md for more advice.