Coder Social home page Coder Social logo

semver's Introduction

composer/semver

Semver 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.

Build Status

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. 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 providers the following methods:

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

License

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

semver's People

Contributors

adragus-inviqa avatar alcohol avatar alexeykupershtokh avatar arcturial avatar christianriesen avatar everzet avatar francoispluchino avatar getjump avatar hannesvdvreken avatar hason avatar jmikola avatar legoktm avatar localheinz avatar lyrixx avatar naderman avatar pborreli avatar seldaek avatar shanethehat avatar simensen avatar stof avatar till avatar weaverryan avatar xaav avatar zczapran avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.