cubicl/php-sorting

A sorting library for PHP

Maintainers

Package info

github.com/CubiclDev/php-sorting

Homepage

pkg:composer/cubicl/php-sorting

Statistics

Installs: 4 414

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2023-06-02 15:26 UTC

This package is auto-updated.

Last update: 2026-03-01 00:12:51 UTC


README

Implementation of a generic sorting system with an interface definition compatible to the Comparable RFC.

Usage

You have two possible options. Depending on your use case you can implement the Cubicl\Sorting\Comparable interface or use a comparator.

<?php

// with a comparable
$orderedList = $sortManager->sortComparable($unorderedListOfComparable);

// or with a comparator
$orderedList = $sortManager->sortWithComparator($comparator, $unorderedList);