2017 © Pedro Peláez
 

library semver

parser for semantic versioning

image

andrelohmann/semver

parser for semantic versioning

  • Friday, September 18, 2015
  • by andrelohmann
  • Repository
  • 1 Watchers
  • 0 Stars
  • 641 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

SemVer

This is a Semantic Versioning 2.0.0 parser for PHP 5.4 and 5.5. It defines a simple interface Parser that validates that a version is properly formatted and parses it into a Version class:, (*1)

namespace League\SemVer;

interface Parser
{

    /**
     * @param string $version
     * @return Version
     */
    function parse($version);

    /**
     * @param string $version
     * @return bool
     */
    function isValidVersion($version);

}

Usage

$parser = new League\SemVer\RegexParser();
var_dump($parser->parse('not a valid version'));
var_dump($parser->parse('1.0.0-alpha.1+48e4f51e0b2751ec3bc4a2bde809e46d60eb1d6e'));

Result:, (*2)

NULL
object(League\SemVer\Version)#3 (5) {
  ["major"]=>
  string(1) "1"
  ["minor"]=>
  string(1) "0"
  ["patch"]=>
  string(1) "0"
  ["pre_release"]=>
  array(2) {
    [0]=>
    string(5) "alpha"
    [1]=>
    int(1)
  }
  ["build"]=>
  array(1) {
    [0]=>
    string(40) "48e4f51e0b2751ec3bc4a2bde809e46d60eb1d6e"
  }
}

Note that there is CachingParser that can be used to cache the results of parsing, but some preliminary tests indicate that reparsing the version is actually faster., (*3)

Requirements

  • PHP 5.4 or 5.5
  • PHPUnit (version unknown) - for running tests.

The Versions

18/09 2015

dev-develop

dev-develop

parser for semantic versioning

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4

 

parser semver

18/09 2015

dev-master

9999999-dev

parser for semantic versioning

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4

 

parser semver

18/09 2015

v1.1.2

1.1.2.0

parser for semantic versioning

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4

 

parser semver

10/09 2015

v1.1.0

1.1.0.0

parser for semantic versioning

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

parser semver

07/09 2015

v1.0.0

1.0.0.0

parser for semantic versioning

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.2

 

parser semver