codecounter / versionmatcher
1.0
2018-12-07 08:07 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2025-06-10 23:26:37 UTC
README
Compare versions with logic opertation. (Actually, it's a project to test ci/cd)
Installation
- With composer
{
...
"require": {
"codecounter/versionmatcher": "0.1.0"
}
}
- Without composer
require "/path/to/VersionMatcher/autoload.php"
Usage
- Compare 2 version strings
// produce `false` \CodeCounter\VersionMatcher::test('ver >= 1.2.0', array( 'ver' => '1.1.0' ));
- Compare with logic
// produce `true` \CodeCounter\VersionMatcher::test('ver >= 1.2.0 && ver < 1.6.0', array( 'ver' => '1.3.0' ));
- Persisted object
$matcher = new \CodeCounter\VersionMatcher(array( 'android' => '1.3.0', 'ios' => '' )); // produce `true` $matcher->match('ios >= 1.4.0 || android >= 1.3.0'); // produce `false` $matcher->match('ios >= 1.4.0 || android < 1.2.0');
For detailed usage, please view tests
directory.
Develop
- Clone repository
cd dev
cp docker-compose.example.yml docker-compose.yml
, modify it if necessarydocker-compose up -d
docker-compose exec php bash
, ssh to the containercd /var/www
then, you can run unit test by phpunit
, or code sniffer by phpcs
.
php tests/coverage-check.php
after phpunit
, this script can exit stdout with 1
when coverage < 90%, for ci notification.
License
This library is under MIT license.