PHPackages                             yusufalper/laravel-order - 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. yusufalper/laravel-order

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

yusufalper/laravel-order
========================

\#todo: description will be here

v4.0.0(1y ago)26MITPHPPHP ^8.1

Since Jan 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yusufalper/laravel-order)[ Packagist](https://packagist.org/packages/yusufalper/laravel-order)[ Docs](https://github.com/yusufalper/laravel-order)[ GitHub Sponsors](https://github.com/yusufalper)[ RSS](/packages/yusufalper-laravel-order/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Package Summary
===============

[](#package-summary)

This Laravel package provides a handy trait called HasOrder designed to simplify the management of ordered records in your Eloquent models. By applying this trait to your models, you introduce an 'order' attribute, allowing you to effortlessly handle the ordering of records within a given model.

[![Latest Version on Packagist](https://camo.githubusercontent.com/947a539f75278240ee55e7e2b35459d1fb27b979a61e38325faf4f1bc0ee5239/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7975737566616c7065722f6c61726176656c2d6f726465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yusufalper/laravel-order)[![Total Downloads](https://camo.githubusercontent.com/9b1971676c34e872eff6c5813b7a0b12c29d988f19f32d0bc8c99e5cd51b527d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7975737566616c7065722f6c61726176656c2d6f726465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yusufalper/laravel-order)

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

[](#installation)

You can install the package via composer:

```
composer require yusufalper/laravel-order
```

Usage
-----

[](#usage)

1. Apply Trait: Simply apply the HasOrder trait to your Eloquent model. Ensure that your model's migration includes a column (integer and nullable) specified in model as '$orderAttrName' (see example in below) to support the ordering functionality.
2. Optional Configuration: Define $orderUnificationAttributes (public array) within your model to fine-tune the ordering behavior according to your application's specific requirements. For example if you add 'user\_id' attribute to $orderUnificationAttributes, then your ordering will be user\_id based ordering.
3. Automatic Handling: The package takes care of automatic order adjustments during record creation, ensuring a seamless and organized ordering process.
4. Effortless Update and Delete: The HasOrder trait also seamlessly handles updates and deletes, maintaining the correct order of records based on your defined criteria.

Example Usage
-------------

[](#example-usage)

```
use Illuminate\Database\Eloquent\Model;
use Alper\LaravelOrder\Traits\HasOrder;

class CompanyBranch extends Model
{
    use HasOrder;

    protected $fillable = [
        'order'
        'company_id'
    ];

    public string $orderAttrName = 'order';

    public array $orderUnificationAttributes = [
        'company_id'
    ];
}
```

If you have multiple traits that each of which has a boot method, Then you should use like this:

```
use Illuminate\Database\Eloquent\Model;
use Alper\LaravelOrder\Traits\HasOrder;

class CompanyBranch extends Model
{
    use HasOrder {
        HasOrder::boot as bootHasOrderTrait;
    }
    use OtherTrait {
        OtherTrait::boot as bootOtherTraitTrait;
    }

    public static function boot(): void
    {
        static::bootHasOrderTrait();
        static::bootOtherTraitTrait();
    }

    protected $fillable = [
        'order'
        'company_id'
    ];

    public string $orderAttrName = 'order';

    public array $orderUnificationAttributes = [
        'company_id'
    ];
}
```

By integrating the HasOrder trait into your Laravel models, you streamline the process of managing ordered records, offering enhanced control and flexibility.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Alper](https://github.com/yusufalper)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

5

Last Release

711d ago

Major Versions

v1.1.0 → v2.0.02024-01-14

v2.0.0 → v3.0.02024-06-06

v3.0.0 → v4.0.02024-07-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/febcfd23ce3ea601926c52ab39d0988dc03a1b289f86f5bd87beff284f22f2f8?d=identicon)[yusufalper](/maintainers/yusufalper)

---

Top Contributors

[![yusufalper](https://avatars.githubusercontent.com/u/17886290?v=4)](https://github.com/yusufalper "yusufalper (17 commits)")

---

Tags

laravelAlperlaravel-order

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/yusufalper-laravel-order/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

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