承接 andrelohmann/semver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andrelohmann/semver

最新稳定版本:v1.1.2

Composer 安装命令:

composer require andrelohmann/semver

包简介

parser for semantic versioning

README 文档

README

#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:

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:

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.

##Requirements

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

统计信息

  • 总下载量: 1.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-09-10