PHPackages                             librette/doctrine-sortable - 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. [Database &amp; ORM](/categories/database)
4. /
5. librette/doctrine-sortable

ActiveLibrary[Database &amp; ORM](/categories/database)

librette/doctrine-sortable
==========================

Doctrine sortable entities for Nette framework.

v0.3.0(8y ago)23.3k2[1 PRs](https://github.com/librette/doctrine-sortable/pulls)1BSD-3-ClausePHP

Since Feb 27Pushed 4y ago4 watchersCompare

[ Source](https://github.com/librette/doctrine-sortable)[ Packagist](https://packagist.org/packages/librette/doctrine-sortable)[ RSS](/packages/librette-doctrine-sortable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (4)Used By (1)

doctrine-sortable
=================

[](#doctrine-sortable)

Sooner or later you will have to implement sorting of your entities. For example categories, products on main page and so on. And why you should do this by yourself when everything you have to do is to copy &amp; paste?

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

[](#installation)

The best way to install librette/doctrine-sortable is using [Composer](http://getcomposer.org/):

```
$ composer require librette/doctrine-sortable
```

and enable librette extension in your `config.neon

```
extensions:
	# add this line at the end of your extensions list
	librette.doctrine.sortable: Librette\Doctrine\Sortable\DI\SortableExtension
```

Simplest entity
---------------

```php
namespace App;

use Kdyby\Doctrine\Entities\BaseEntity;
use Librette\Doctrine\Sortable\ISortable;
use Librette\Doctrine\Sortable\TSortable;

/**
 * @ORM\Entity
 */
class Category extends BaseEntity implements ISortable
{
	use TSortable;
	/**
	 * @ORM\Id
	 * @ORM\Column(type="integer")
	 * @ORM\GeneratedValue
	 */
	protected $id;
}
```

Trait TSortable
---------------

There is trait `TSortable` that implements basic sorting methods to your entity.
Everything you need is to call those methods in your service / presenter.

```php
// you can move your entity up or down
$entity->moveUp();
$entity->moveDown();
// or you can put it before / after another one
$entity->moveBefore($anotherEntity);
$entity->moveAfter($anotherEntity);
// also you can set position directly
$entity->setPosition(21);
```

**Don't forget to persist and flush after you finish with sorting!**

```php
$this->em->persist($entity);
$this->em->flush();
```
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% 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 ~545 days

Total

3

Last Release

2999d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24237c1135d761c9477a0b3da5fa8a105a1f21984b4b2e2ae0ba2083ba6f825f?d=identicon)[matej21](/maintainers/matej21)

---

Top Contributors

[![matej21](https://avatars.githubusercontent.com/u/1276059?v=4)](https://github.com/matej21 "matej21 (14 commits)")[![northys](https://avatars.githubusercontent.com/u/2878126?v=4)](https://github.com/northys "northys (3 commits)")

---

Tags

nettedoctrinesortablelibrette

### Embed Badge

![Health badge](/badges/librette-doctrine-sortable/health.svg)

```
[![Health](https://phpackages.com/badges/librette-doctrine-sortable/health.svg)](https://phpackages.com/packages/librette-doctrine-sortable)
```

###  Alternatives

[kdyby/doctrine

Doctrine integration into Nette Framework

1091.0M86](/packages/kdyby-doctrine)[nettrine/orm

Doctrine ORM for Nette Framework

581.9M37](/packages/nettrine-orm)[nettrine/migrations

Doctrine Migrations for Nette Framework

411.7M17](/packages/nettrine-migrations)[nettrine/dbal

Doctrine DBAL for Nette Framework

322.6M19](/packages/nettrine-dbal)[kdyby/doctrine-cache

Doctrine Cache bridge for Nette Framework

101.3M19](/packages/kdyby-doctrine-cache)[kdyby/annotations

Doctrine Annotations integration into Nette Framework

101.3M18](/packages/kdyby-annotations)

PHPackages © 2026

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