fractal / semver
该包有助于处理语义版本。
v1.0.1
2019-09-25 11:23 UTC
Requires
- php: ^7.1
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.23.4
- php-coveralls/php-coveralls: ^2.1
- phpunit/php-code-coverage: ^6.1
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-08-25 22:27:57 UTC
README
覆盖率与质量
构建
其他
特性
- 简单的语义版本操作包。
- 比较语义版本。
- 验证语义版本。
- 如果版本不是彼此的实例,则抛出异常。
使用方法
Fractal\SemVer\SemanticVersion 类
<?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 类
<?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
许可
SemVer 包是开源软件,许可协议为 MIT 许可。