PHPackages                             stratadox/sorting - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. stratadox/sorting

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stratadox/sorting
=================

v0.3.1(6y ago)014.6k↓26.7%[1 issues](https://github.com/Stratadox/Sorting/issues)MITPHPPHP &gt;=7.0CI failing

Since Dec 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Stratadox/Sorting)[ Packagist](https://packagist.org/packages/stratadox/sorting)[ RSS](/packages/stratadox-sorting/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

Sorting
=======

[](#sorting)

[![Build Status](https://camo.githubusercontent.com/5a7854ef1cf761497622c8bc3240ad96832fe4167db6bc6b37e2117eb1d281c2/68747470733a2f2f7472617669732d63692e6f72672f537472617461646f782f536f7274696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Stratadox/Sorting)[![Coverage Status](https://camo.githubusercontent.com/95346341b39e777915f119f32fc97fc2f6f28305cb1fee6c3043c2246c5b2d99/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f537472617461646f782f536f7274696e672f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Stratadox/Sorting?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6ef782af95b7171da98dddda4666b1cdc93f6f413b9c8ac106ee909a2430d935/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f537472617461646f782f536f7274696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Stratadox/Sorting/?branch=master)

The sorting package contains tools to sort data structures like tables or collections of objects.

Sorting instructions are objects and can therefore easily be passed along as parameters. Multiple instructions can be chained in order to sort by several fields.

Installation
------------

[](#installation)

Install using composer:

`composer require stratadox/sorting`

Basic usage
-----------

[](#basic-usage)

### 2D Arrays

[](#2d-arrays)

When sorting a collection of associative arrays, use:

```
