rmtram/version-sort

v1.0.0 2016-02-08 19:00 UTC

This package is auto-updated.

Last update: 2024-10-21 21:00:36 UTC


README

Build Status Total Downloads Latest Stable Version

Introduction

Library to sort a very simple version.

Install

Composer

$ composer require rmtram/version-sort

Basic

Source Download

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