PHPackages                             runroom-packages/sortable-behavior-bundle - 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. [Admin Panels](/categories/admin)
4. /
5. runroom-packages/sortable-behavior-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

runroom-packages/sortable-behavior-bundle
=========================================

Provides a way to sort your admin listing

0.21.0(7mo ago)111.3M↓36.5%10[1 PRs](https://github.com/Runroom/RunroomSortableBehaviorBundle/pulls)1MITPHPPHP ^8.1CI passing

Since Mar 16Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/Runroom/RunroomSortableBehaviorBundle)[ Packagist](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)[ Docs](https://github.com/runroom/RunroomSortableBehaviorBundle)[ RSS](/packages/runroom-packages-sortable-behavior-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (27)Versions (60)Used By (1)

RunroomSortableBehaviorBundle
=============================

[](#runroomsortablebehaviorbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/3bc463cae62b17ba0b3da160d0085a4927cee344ef2fd483e26b435cf09fd4d7/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f762f737461626c65)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/6bdc8ac50e0ecde367c8f9f99a6434bfd6f03c8898879b7e45a0356061430ef4/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)[![License](https://camo.githubusercontent.com/c89a24dbe0ebfc6c95b8271a24bd4ac54aeec72a2a1d50eaf8da462d4aecaa20/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f6c6963656e7365)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)

[![Total Downloads](https://camo.githubusercontent.com/1d26d44d485644504cd8f50d761c4baa4352c8fc95275d0a67581eb1a0db1c28/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)[![Monthly Downloads](https://camo.githubusercontent.com/6b8adca9521bc45fc0531c3a251583e496090ea8e895f80b172c051b21f88356/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f642f6d6f6e74686c79)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)[![Daily Downloads](https://camo.githubusercontent.com/61b50787964e6e4dd6ae6ae5857b96ff003f253897e114f78be00531bb90a967/68747470733a2f2f706f7365722e707567782e6f72672f72756e726f6f6d2d7061636b616765732f736f727461626c652d6265686176696f722d62756e646c652f642f6461696c79)](https://packagist.org/packages/runroom-packages/sortable-behavior-bundle)

This bundle gives the ability to define sortable entities and to be able to sort the using Sonata Backoffice. It is inspired on: [pixSortableBehaviorBundle](https://github.com/pix-digital/pixSortableBehaviorBundle).

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

[](#installation)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require runroom-packages/sortable-behavior-bundle
```

### Enable the Bundle

[](#enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Runroom\SortableBehaviorBundle\RunroomSortableBehaviorBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

This bundle checks if you are using [Gedmo Sortable](https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/sortable.md) to handle the sort order of your entities, if not, it will use the default ORM implementation, where you will need to add entities on the configuration of the bundle manually. If you are using Gedmo, and don't want to change the default field name `position`, you don't need to configure anything for the bundle.

We provide a trait, so you can easily add the position field with the Gedmo configuration on each entity you want to be able to sort:

```
# src/Entity/Example.php

namespace App\Entity;

use Runroom\SortableBehaviorBundle\Behaviors\Sortable;

class Example
{
    use Sortable;
    // ... rest of your class
}
```

And then, on your admin class, you can add the `SortableAdminTrait` trait to be able to sort the entities on the list view:

```
# src/Admin/ExampleAdmin.php

namespace App\Admin;

use Runroom\SortableBehaviorBundle\Admin\SortableAdminTrait;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;

class ExampleAdmin extends AbstractAdmin
{
    use SortableAdminTrait;

    protected function configureListFields(ListMapper $list): void
    {
        $list
            // ... rest of your list fields
            ->add(ListMapper::NAME_ACTIONS, ListMapper::TYPE_ACTIONS, [
                'actions' => [
                    // ... rest of your actions
                    'move' => [
                        'template' => '@RunroomSortableBehavior/sort.html.twig',
                    ],
                ],
            ]);
    }
}
```

And that's all, you should now see the sort buttons on the list view of your admin class.

### Configuration

[](#configuration)

```
# config/packages/runroom_sortable_behavior.yaml

runroom_sortable_behavior:
    # position_handler can be any service id that implements the PositionHandlerInterface
    position_handler: Runroom\SortableBehaviorBundle\Service\GedmoPositionHandler # or Runroom\SortableBehaviorBundle\Service\ORMPositionHandler if gedmo is not found
    position_field:
        default: position # Default field name for the position
        # Only needed when not using Gedmo
        entities:
            App\Entity\Foobar: order
            App\Entity\Baz: rang
    # Only needed when not using Gedmo
    sortable_groups:
        entities:
            App\Entity\Baz: [group]
```

### Use a draggable list instead of up/down buttons

[](#use-a-draggable-list-instead-of-updown-buttons)

In order to use a draggable list instead of up/down buttons, change the template in the `move` action to `@RunroomSortableBehavior/sort_drag_drop.html.twig`.

```
protected function configureListFields(ListMapper $list): void
{
    $list
        // ... rest of your list fields
        ->add(ListMapper::NAME_ACTIONS, ListMapper::TYPE_ACTIONS, [
            'actions' => [
                // ... rest of your actions
                'move'   => [
                    'template' => '@RunroomSortableBehavior/sort_drag_drop.html.twig',
                    'enable_top_bottom_buttons' => true, // optional
                ],
            ],
        ]);
}
```

Contribute
----------

[](#contribute)

The sources of this package are contained in the Runroom monorepo. We welcome contributions for this package on [runroom/runroom-packages](https://github.com/Runroom/runroom-packages).

License
-------

[](#license)

This bundle is under the [MIT license](LICENSE).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance63

Regular maintenance activity

Popularity49

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 63.1% 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 ~35 days

Recently: every ~113 days

Total

59

Last Release

227d ago

PHP version history (4 changes)0.1.0PHP ^7.3

0.9.1PHP ^7.3 || ^8.0

v0.10.0PHP ^7.4 || ^8.0

0.17.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/33302a19f0ac61f85039144cddb66a44136f96aa64a72e4d3167c6d8f15b59ac?d=identicon)[jordism91](/maintainers/jordism91)

---

Top Contributors

[![jenkins-runroom](https://avatars.githubusercontent.com/u/62430145?v=4)](https://github.com/jenkins-runroom "jenkins-runroom (111 commits)")[![jordisala1991](https://avatars.githubusercontent.com/u/1137485?v=4)](https://github.com/jordisala1991 "jordisala1991 (65 commits)")

---

Tags

listphpsonatasonata-adminsortablesymfonysymfony-bundlesortableadminsonata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/runroom-packages-sortable-behavior-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/runroom-packages-sortable-behavior-bundle/health.svg)](https://phpackages.com/packages/runroom-packages-sortable-behavior-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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