Skip to content

Rmtram/VersionSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VersionSort

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