kubik / sorter
Sort library
1.0
2019-05-03 13:14 UTC
Requires
- php: >=7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
This package is auto-updated.
Last update: 2025-07-07 20:25:54 UTC
README
This is a PHP Sorting Library can sorts array objects from large to small and from small to large.
Installation
$ composer require kubik/sorter
Usage
Sorting from smaller
$sorter = new Sorter(new SorterFromSmaller()); print_r($sorter->sort($array));
Sorting from large
$sorter = new Sorter(new SorterFromLarge()); print_r($sorter->sort($array));
Switch startegy sorting
$sorter = new Sorter(new SorterFromSmaller()); print_r($sorter->sort($array)); $sorter->setStrategy(new SorterFromLarge()); print_r($sorter->sort($array));
License
This project is released under the terms of the BSD-3-Clause license.
Copyright (c) 2019, Anton Kubrak