Search by

adachsoft / version-php

Arkadiusz Adach

PHP adapters for reading and calculating semantic versions from Composer metadata and Git tags.

Package info

gitlab.com/a.adach/version-php

Issues

pkg:composer/adachsoft/version-php

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-10-10 08:17 UTC

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.