rmtram / version-sort
Version sort
v1.0.0
2016-02-08 19:00 UTC
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-10-21 21:00:36 UTC
README
Introduction
Library to sort a very simple version.
Install
Composer
$ composer require rmtram/version-sort
Basic
Copy File => src/VersionSort.php
require '/path/to/VersionSort.php';
Example
$versions = array('v1.0.1', '1.30.3', 'version1.0.99', '1.0.4'); $vs = new Rmtram\VersionSort\VersionSort($versions); // trimming v1.0.1 => 1.0.1 | version1.0.99 => 1.0.99 $vs->trim(); var_dump($vs->asc()); // result => ['1.0.1', '1.0.4', '1.0.99', '1.30.3'] var_dump($vs->desc()); // result => ['1.30.3', '1.0.99', '1.0.4', '1.0.1']
Support Version.
- PHP 5.3
- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- HHVM