fractal/semver
Composer 安装命令:
composer require fractal/semver
包简介
The package helps to work with semantic versions.
README 文档
README
Coverage and Quality:
Build:
Other:
Features
- Simple package for semantic version manipulation.
- Compare semantic version.
- Validates semantic version.
- Throws exceptions if Versions are not instance of each other.
Usage
Fractal\SemVer\SemanticVersion class:
<?php use Fractal\SemVer\SemanticVersion; ## Create instance of SemVer ## If SemVer not valid, throws \Fractal\SemVer\Exceptions\ParseVersionException $version = SemanticVersion::fromString('1.0.0'); # \Fractal\SemVer\Contracts\VersionInterface $other = SemanticVersion::fromString('0.1.0'); # \Fractal\SemVer\Contracts\VersionInterface ## Version can compare each other ## If compare operator not valid, throws \Fractal\SemVer\Exceptions\InvalidOperatorException ## If version and other version are not instance of each other, throws \Fractal\SemVer\Exceptions\VersionClassNotEqualException $version->eq($other); # false $version->gte($other); # true
Fractal\SemVer\Comparator class:
<?php use Fractal\SemVer\SemanticVersion; use Fractal\SemVer\Comparator; ## Create instance of SemVer ## If SemVer not valid, throws \Fractal\SemVer\Exceptions\ParseVersionException $version = SemanticVersion::fromString('1.0.0'); # \Fractal\SemVer\Contracts\VersionInterface $other = SemanticVersion::fromString('0.1.0'); # \Fractal\SemVer\Contracts\VersionInterface ## Compare versions with comparator ## If compare operator not valid, throws \Fractal\SemVer\Exceptions\InvalidOperatorException ## If version and other version are not instance of each other, throws \Fractal\SemVer\Exceptions\VersionClassNotEqualException Comparator::eq($version, $other); # false Comparator::gte($version, $other); # true
License
The SemVer package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-18