PHPackages                             konsulting/laravel-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. konsulting/laravel-sorting

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

konsulting/laravel-sorting
==========================

A sorting package for laravel

0.1.9(4mo ago)0462MITPHPPHP ^5.6 | ^7.0 | ^8.0

Since Nov 22Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/konsulting/laravel-sorting)[ Packagist](https://packagist.org/packages/konsulting/laravel-sorting)[ RSS](/packages/konsulting-laravel-sorting/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (10)Used By (0)

Sorting
=======

[](#sorting)

*A set of utilities for sorting models in [Laravel](https://laravel.com).*

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

[](#installation)

Install using composer: `composer require konsulting/laravel-sorting`

Usage
-----

[](#usage)

### Sorting

[](#sorting-1)

- Add the `Konsulting\Laravel\Sorting\Sortable` trait to your model.
- Set up the configuration for the model by adding the `$sortableSettings` property providing the allowed sortable fields and a default sort order.

```
protected static $sortableSettings = [
    'sortable' => ['name', 'created_at', 'updated_at'],
    'defaultSort' => '+name',
];
```

- In your view where you’d like to add a sortable link, include the following (example for a Post model):

```
{{ App\Post::sortableLink('name', 'Name') }}
```

- When you want retrive a sorted collection of models, use the `sort()` method.

```
App\Post::sort()->paginate();
// The sort method will extract the sort variable from the request, unless you pass them through (e.g. if you store in the session).
```

### Prioritise

[](#prioritise)

- Add the `Konsulting\Laravel\Sorting\Prioritise` trait to your model.
- Ensure your model has a column for 'priority'. By default, this is called 'priority' but can be overriden if needed by overriding the `determinePriorityColumnName()` method in the model.
- Use the `prioritise` scope to sort the retrieved results by priority.

Security
--------

[](#security)

If you find any security issues, or have any concerns, please email [keoghan@klever.co.uk](keoghan@klever.co.uk), rather than using the issue tracker.

Contributing
------------

[](#contributing)

Contributions are welcome and will be fully credited. We will accept contributions by Pull Request.

Please:

- Use the PSR-2 Coding Standard
- Add tests, if you’re not sure how, please ask.
- Document changes in behaviour, including readme.md.

Testing
-------

[](#testing)

We use [PHPUnit](https://phpunit.de).

Run tests using PHPUnit: `vendor/bin/phpunit`

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance75

Regular maintenance activity

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~420 days

Recently: every ~278 days

Total

9

Last Release

139d ago

PHP version history (2 changes)0.1.0PHP ^5.6 | ^7.0

0.1.5PHP ^5.6 | ^7.0 | ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4703657?v=4)[Konsulting](/maintainers/konsulting)[@konsulting](https://github.com/konsulting)

---

Top Contributors

[![Keoghan](https://avatars.githubusercontent.com/u/6714599?v=4)](https://github.com/Keoghan "Keoghan (12 commits)")[![rdarcy1](https://avatars.githubusercontent.com/u/15962421?v=4)](https://github.com/rdarcy1 "rdarcy1 (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/konsulting-laravel-sorting/health.svg)

```
[![Health](https://phpackages.com/badges/konsulting-laravel-sorting/health.svg)](https://phpackages.com/packages/konsulting-laravel-sorting)
```

###  Alternatives

[spatie/laravel-settings

Store your application settings

1.5k6.8M135](/packages/spatie-laravel-settings)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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