annotate vendor/composer/semver/README.md @ 19:fa3358dc1485 tip

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