Files
PHPMailer6
auswertung
bootstrap
classes
config
controller
dashboard
datepicker
fpdf186
jquery
js
language
lib
media
msd
ReadMe
css
images
inc
js
language
mod_cron
tpl
vendor
composer
semver
src
CHANGELOG.md
LICENSE
README.md
composer.json
ClassLoader.php
InstalledVersions.php
LICENSE
autoload_classmap.php
autoload_files.php
autoload_namespaces.php
autoload_psr4.php
autoload_real.php
autoload_static.php
installed.json
installed.php
platform_check.php
desarrolla2
league
monolog
phpseclib
psr
visualappeal
autoload.php
.gitignore
.htaccess
.htpasswd
README.md
composer.json
composer.lock
config.php
config_overview.php
dump.php
filemanagement.php
help.php
index.php
install.php
license.txt
log.php
main.php
menu.php
refresh_dblist.php
restore.php
sql.php
selfregistration
sql
survey
templates
test
tinymce
.gitignore
Hinweise_zu_php8.txt
config.inc.php
todo.txt
survey/msd/vendor/composer/semver/README.md
2023-07-25 19:16:12 +02:00

3.0 KiB

composer/semver

Semver (Semantic Versioning) library that offers utilities, version constraint parsing and validation.

Originally written as part of composer/composer, now extracted and made available as a stand-alone library.

Continuous Integration

Installation

Install the latest version with:

$ composer require composer/semver

Requirements

  • PHP 5.3.2 is required but using the latest version of PHP is highly recommended.

Version Comparison

For details on how versions are compared, refer to the Versions article in the documentation section of the getcomposer.org website.

Basic usage

Comparator

The Composer\Semver\Comparator class provides the following methods for comparing versions:

  • greaterThan($v1, $v2)
  • greaterThanOrEqualTo($v1, $v2)
  • lessThan($v1, $v2)
  • lessThanOrEqualTo($v1, $v2)
  • equalTo($v1, $v2)
  • notEqualTo($v1, $v2)

Each function takes two version strings as arguments and returns a boolean. For example:

use Composer\Semver\Comparator;

Comparator::greaterThan('1.25.0', '1.24.0'); // 1.25.0 > 1.24.0

Semver

The Composer\Semver\Semver class provides the following methods:

  • satisfies($version, $constraints)
  • satisfiedBy(array $versions, $constraint)
  • sort($versions)
  • rsort($versions)

Intervals

The Composer\Semver\Intervals static class provides a few utilities to work with complex constraints or read version intervals from a constraint:

use Composer\Semver\Intervals;

// Checks whether $candidate is a subset of $constraint
Intervals::isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint);

// Checks whether $a and $b have any intersection, equivalent to $a->matches($b)
Intervals::haveIntersections(ConstraintInterface $a, ConstraintInterface $b);

// Optimizes a complex multi constraint by merging all intervals down to the smallest
// possible multi constraint. The drawbacks are this is not very fast, and the resulting
// multi constraint will have no human readable prettyConstraint configured on it
Intervals::compactConstraint(ConstraintInterface $constraint);

// Creates an array of numeric intervals and branch constraints representing a given constraint
Intervals::get(ConstraintInterface $constraint);

// Clears the memoization cache when you are done processing constraints
Intervals::clear()

See the class docblocks for more details.

License

composer/semver is licensed under the MIT License, see the LICENSE file for details.