-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Operator class is final now. Simplify regular expression for version validation.
- Loading branch information
1 parent
edcb49f
commit 7598f7c
Showing
3 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,58 @@ | ||
#COMING SOON | ||
Code is good commented. | ||
# The package helps to work with semantic versions. | ||
|
||
[![Coverage Status](https://coveralls.io/repos/github/fractalzombie/semver/badge.svg?branch=master)](https://coveralls.io/github/fractalzombie/semver?branch=master) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fractalzombie/semver/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fractalzombie/semver/?branch=master) | ||
[![Code Coverage](https://scrutinizer-ci.com/g/fractalzombie/semver/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/fractalzombie/semver/?branch=master) | ||
[![Build Status](https://scrutinizer-ci.com/g/fractalzombie/semver/badges/build.png?b=master)](https://scrutinizer-ci.com/g/fractalzombie/semver/build-status/master) | ||
[![Code Intelligence Status](https://scrutinizer-ci.com/g/fractalzombie/semver/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence) | ||
[![Build Status](https://travis-ci.org/fractalzombie/semver.svg?branch=master)](https://travis-ci.org/fractalzombie/semver) | ||
[![Build Status](https://travis-ci.org/fractalzombie/semver.svg?branch=master)](https://travis-ci.org/fractalzombie/semver) | ||
|
||
## 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 | ||
<?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 | ||
<?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](http://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters