php-extended/php-version-parser-object

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-version-object package instead.

A library that implements the php-extended/php-version-parser-interface library

3.0.17 2021-06-25 11:19 UTC

This package is auto-updated.

Last update: 2021-06-25 21:40:44 UTC


README

A library that implements the php-extended/php-version-parser-interface library.

coverage build status

This parser aims to be a composer-compliant version parser (see versions), and implements all of its rules except for the hyphenated version range.

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-version-parser-object": "^3"
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

You may build version range objects with the following code :


use PhpExtended\Version\VersionConstraintParser;

$parser = new VersionConstraintParser();

$constraint = $parser->parse('>1.1.0 <=1.2.3 || >=1.4')
$constraint->__toString(); // ((>1.1.0 && <=1.2.3) || >=1.4)

$range = $constraint->getRange();
$range->__toString(); // ]1.1.0, 1.2.3] U [1.4.0, +inf[

$range->containsVersion(new Version(1, 1, 42)); // true
$range->containsversion(new Version(1, 3, 0)); // false

License

MIT (See license file).