PHPackages                             lav45/sort-list - 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. lav45/sort-list

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

lav45/sort-list
===============

Sort items list and recursive add prefix to child items

1.0.1(11y ago)12.0k1BSD-2-ClausePHP

Since May 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/LAV45/sort-list)[ Packagist](https://packagist.org/packages/lav45/sort-list)[ RSS](/packages/lav45-sort-list/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (3)Used By (0)

SortList
========

[](#sortlist)

Sort items list and recursive add prefix to child items

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist lav45/sort-list "*"

```

or add

```
"lav45/sort-list": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension for Yii2 is installed, simply use it in your code by :

```
use lav45\SortList;

$data = Category::find()
    ->select(['id', 'parent_id', 'name' => 'title'])
    ->asArray()
    ->all();

print_r($data);
/**
 * Array
 * (
 *    [0] => Array
 *        (
 *            [id] => 1
 *            [parent_id] =>
 *            [title] => Auto
 *        )
 *
 *    [1] => Array
 *        (
 *            [id] => 2
 *            [parent_id] => 1
 *            [title] => Car
 *        )
 *
 *    [2] => Array
 *        (
 *            [id] => 3
 *            [parent_id] => 1
 *            [title] => Motorcycle
 *        )
 * )
 */

$sortList = (new SortList($data))->getList();

print_r($sortList);
/**
 * Array
 * (
 *    [0] => Array
 *        (
 *            [id] => 1
 *            [title] => Auto
 *        )
 *
 *    [1] => Array
 *        (
 *            [id] => 2
 *            [title] => - Car
 *        )
 *
 *    [2] => Array
 *        (
 *            [id] => 3
 *            [title] => - Motorcycle
 *        )
 * )
 */

$dropDownList = ArrayHelper::map($sortList, 'id', 'title');

print_r($sortList);
/**
 * Array
 * (
 *     [1] => Auto
 *     [2] => - Car
 *     [3] => - Motorcycle
 * )
 */
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~0 days

Total

2

Last Release

4051d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/675367?v=4)[Alex](/maintainers/LAV45)[@lav45](https://github.com/lav45)

---

Top Contributors

[![lav45](https://avatars.githubusercontent.com/u/675367?v=4)](https://github.com/lav45 "lav45 (3 commits)")

### Embed Badge

![Health badge](/badges/lav45-sort-list/health.svg)

```
[![Health](https://phpackages.com/badges/lav45-sort-list/health.svg)](https://phpackages.com/packages/lav45-sort-list)
```

###  Alternatives

[aternos/thanos

Simple library to detect and remove unused chunks from a Minecraft world.

267587.5k](/packages/aternos-thanos)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

45823.2k3](/packages/pimcore-data-importer)[pinga/tembo

A simple PHP EPP client

281.1k1](/packages/pinga-tembo)

PHPackages © 2026

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