PHPackages                             gmi/toolkit-sorter - 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. gmi/toolkit-sorter

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

gmi/toolkit-sorter
==================

Sort interfaces and file sorter

1.0.2(5y ago)04761LGPL-3.0-onlyPHPPHP &gt;=5.6.0CI failing

Since Jan 30Pushed 3y ago4 watchersCompare

[ Source](https://github.com/gmitirol/toolkit-sorter)[ Packagist](https://packagist.org/packages/gmi/toolkit-sorter)[ Docs](https://github.com/gmitirol/toolkit-sorter)[ RSS](/packages/gmi-toolkit-sorter/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (2)Versions (4)Used By (1)

PHP Toolkit - Sorter
====================

[](#php-toolkit---sorter)

This library provides simple abstractions for sort operations.

In version 1.0, toolkit-sorter provides easy sorting of files by various criteria. Files are passed as `SplFileInfo` objects, e.g. as retrieved from Symfony the Finder component.

Additonal sort algorithms for reuse will be added in later releases.

The current build status and code analysis can be found here:

- [Scrutinizer CI](https://scrutinizer-ci.com/g/gmitirol/toolkit-sorter/)

Requirements
------------

[](#requirements)

- PHP 5.6.0 or higher

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

[](#installation)

The recommended way to install toolkit-sorter is via composer.

```
"require": {
    "gmi/toolkit-sorter": "1.0.*"
}
```

Usage examples
--------------

[](#usage-examples)

Sorting of SplFileInfo objects

```
use Gmi\Toolkit\Sorter\NaturalFileSorter;

$files = ['file1.pdf', 'file2.pdf'];
$fileInfos = [];
foreach ($files as $file) {
    $fileInfos[] = new SplFileInfo($file);
}

$sorter = new NaturalFileSorter();
$sorter->sort($fileInfos);
```

Sorting of SplFileInfo objects by multiple criteria

```
use Gmi\Toolkit\Sorter\GroupSorter;
use Gmi\Toolkit\Sorter\ExtensionFileSorter;
use Gmi\Toolkit\Sorter\SizeFileSorter;

$files = ['file1.pdf', 'file2.pdf', 'file3.pdf', 'file1.jpg', 'file4.pdf', 'file2.jpg'];
$fileInfos = [];
foreach ($files as $file) {
    $fileInfos[] = new SplFileInfo($file);
}

$sorter = new GroupSorter([new ExtensionFileSorter(), new SizeFileSorter()]);
$sorter->sort($fileInfos);
```

Sorting Symfony Finder results

```
use Symfony\Component\Finder\Finder;
use Gmi\Toolkit\Sorter\SizeFileSorter;

$finder = new Finder();
$finder->files()->name('/\.jpg$/i')->in($folder);
$files = iterator_to_array($finder);

$sorter = new SizeFileSorter();
$sorter->sort($files);
```

Direct sorting with Symfony Finder

```
use Symfony\Component\Finder\Finder;
use Gmi\Toolkit\Sorter\ModificationDateFileSorter;

$finder = new Finder();
$finder->files()->name('/\.jpg$/i')->in($folder);

$sorter = new ModificationDateFileSorter();
$finder->sort($sorter->getClosure());
```

Tests
-----

[](#tests)

The test suite can be run with `vendor/bin/phpunit tests`.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~370 days

Total

3

Last Release

1920d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6316e9c35db774eda1f74aa8629e0cda915df7eec254f7b90929ae5049ca1fa0?d=identicon)[andaris](/maintainers/andaris)

![](https://www.gravatar.com/avatar/36e5a70419b45d8c6e57b00e9320911100daeed76818ecbc11eaf35e21115487?d=identicon)[gmi](/maintainers/gmi)

---

Top Contributors

[![xelan](https://avatars.githubusercontent.com/u/5080535?v=4)](https://github.com/xelan "xelan (9 commits)")

---

Tags

file-sortingphpphp7sortsorter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gmi-toolkit-sorter/health.svg)

```
[![Health](https://phpackages.com/badges/gmi-toolkit-sorter/health.svg)](https://phpackages.com/packages/gmi-toolkit-sorter)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
