adachsoft / version-php
PHP adapters for reading and calculating semantic versions from Composer metadata and Git tags.
v0.1.0
2026-10-10 08:17 UTC
Requires
- php: ^8.3
- adachsoft/version-contract: ^0.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7.1
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13.4
- rector/rector: ^2.7
- symplify/phpstan-rules: ^14.18
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-11 04:40:24 UTC
README
adachsoft/version-php provides PHP implementations for reading and calculating semantic versions from Composer metadata and Git tags.
Features
- Read a version from
composer.json. - Read the highest stable version available from Git tags.
- Calculate major, minor, and patch version bumps.
- Use the common contracts from
adachsoft/version-contract.
Installation
composer require adachsoft/version-php
Usage
<?php
declare(strict_types=1);
use AdachSoft\VersionContract\Enum\VersionBumpLevelEnum;
use AdachSoft\VersionPhp\Version\ComposerJsonVersionManager;
$manager = new ComposerJsonVersionManager(__DIR__ . '/composer.json');
$currentVersion = $manager->getCurrentVersion();
$nextVersion = $manager->getNextVersion($currentVersion, VersionBumpLevelEnum::MINOR);
echo $currentVersion->value . PHP_EOL;
echo $nextVersion->value . PHP_EOL;
See docs/examples/version-management.md for additional examples, including Git tag version management.
License
This project is licensed under the MIT License. See the LICENSE file for details.