1composer/semver
2===============
3
4Semver library that offers utilities, version constraint parsing and validation.
5
6Originally written as part of [composer/composer](https://github.com/composer/composer),
7now extracted and made available as a stand-alone library.
8
9[](https://travis-ci.org/composer/semver)
10
11
12Installation
13------------
14
15Install the latest version with:
16
17```bash
18$ composer require composer/semver
19```
20
21
22Requirements
23------------
24
25* PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
26
27
28Version Comparison
29------------------
30
31For details on how versions are compared, refer to the [Versions](https://getcomposer.org/doc/articles/versions.md)
32article in the documentation section of the [getcomposer.org](https://getcomposer.org) website.
33
34
35Basic usage
36-----------
37
38### Comparator
39
40The `Composer\Semver\Comparator` class provides the following methods for comparing versions:
41
42* greaterThan($v1, $v2)
43* greaterThanOrEqualTo($v1, $v2)
44* lessThan($v1, $v2)
45* lessThanOrEqualTo($v1, $v2)
46* equalTo($v1, $v2)
47* notEqualTo($v1, $v2)
48
49Each function takes two version strings as arguments. For example:
50
51```php
52use Composer\Semver\Comparator;
53
54Comparator::greaterThan('1.25.0', '1.24.0'); // 1.25.0 > 1.24.0
55```
56
57### Semver
58
59The `Composer\Semver\Semver` class provides the following methods:
60
61* satisfies($version, $constraints)
62* satisfiedBy(array $versions, $constraint)
63* sort($versions)
64* rsort($versions)
65
66
67License
68-------
69
70composer/semver is licensed under the MIT License, see the LICENSE file for details.
71