dhii / versions
Implementation for dealing with SemVer-compliant versions
Installs: 77 374
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: ^7.1 | ^8.0
- dhii/package-interface: ^0.1.0-alpha3
Requires (Dev)
- phpunit/phpunit: ^7.0 | ^8.0 | ^9.0
- slevomat/coding-standard: ^6.0
- symfony/polyfill-php80: ^1.19
- vimeo/psalm: ^4.4.0
This package is auto-updated.
Last update: 2024-10-08 23:31:08 UTC
README
Implementation for dealing with SemVer-compliant versions.
Details
The idea is to provide a minimal implementation that would deal with standards-compliant version numbers, while being standards compliant itself.
Usage
<?php use Dhii\Versions\StringVersionFactory; $factory = new StringVersionFactory(); $version = $factory->createVersionFromString('0.1.15-alpha1.2.3+hello.world.987'); echo $version->getMajor(); // 0 echo $version->getMinor(); // 1 echo $version->getPatch(); // 15 var_export($version->getPreRelease()); // ['alpha1', 2, 3] var_export($version->getBuild()); // ['hello', 'world', '987']