Library to sort a very simple version.
Composer
$ composer require rmtram/version-sort
Basic
Copy File => src/VersionSort.php
require '/path/to/VersionSort.php';
$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']
- PHP 5.3
- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- HHVM