Library that helps creating, editing, sorting and comparing semantic version numbers
You need PHP >= 5.4.0.
You may install the Vernum Component with Composer (recommended) or manually.
-
Download the
composer.phar
executable or use the installer.$ curl -s https://getcomposer.org/installer | php
-
Create a composer.json defining your dependencies.
{ "require": { "pakled/vernum": "dev-master" } }
-
Run Composer:
php composer.phar install
use Vernum\Parser;
use Vernum\Version;
$parsedVersion = Parser::parse("1.0.2-dev");
$version = new Version(
$parsedVersion['major'],
$parsedVersion['minor'],
$parsedVersion['patch'],
$parsedVersion['labels']
);
echo $version->getMajor();
echo $version->getMinor();
echo $version->getPatch();
Vernum is licensed under the MIT license.