PHPackages                             oneduo/laravel-order-by-field - 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. oneduo/laravel-order-by-field

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

oneduo/laravel-order-by-field
=============================

Laravel query builder order by field method

v0.1.0(3y ago)215[2 PRs](https://github.com/oneduo/laravel-order-by-field/pulls)MITPHPPHP ^8.0

Since Feb 22Pushed 2y ago2 watchersCompare

[ Source](https://github.com/oneduo/laravel-order-by-field)[ Packagist](https://packagist.org/packages/oneduo/laravel-order-by-field)[ Docs](https://github.com/oneduo/laravel-order-by-field)[ RSS](/packages/oneduo-laravel-order-by-field/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (13)Versions (4)Used By (0)

Laravel query builder - order by field
======================================

[](#laravel-query-builder---order-by-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4f43b8323643829654896f1c4141db542d38b5b66ebfb2889fc00e16d9f8b50a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e6564756f2f6c61726176656c2d6f726465722d62792d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oneduo/laravel-order-by-field)[![GitHub Tests Action Status](https://camo.githubusercontent.com/410f8dff2be171aa89cdc97730411abcef3d4e96c1d5f9d50efba6c415025bf0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6e6564756f2f6c61726176656c2d6f726465722d62792d6669656c642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/oneduo/laravel-order-by-field/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/2373ed1241a1724eeed2e912654d64375c7e9c9c53c1427e44f5c8148ab1ce40/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6e6564756f2f6c61726176656c2d6f726465722d62792d6669656c642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/oneduo/laravel-order-by-field/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a1683900840cdff3acfe39eeb8d95b7e0403ab7a174f896d3fb84da9562ffdec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e6564756f2f6c61726176656c2d6f726465722d62792d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oneduo/laravel-order-by-field)

This package adds a `orderByField` macro on the query Builder.

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

[](#installation)

You can install the package via composer:

```
composer require oneduo/laravel-order-by-field
```

Usage
-----

[](#usage)

```
$keys = [42, 1, 100]
$users = User::query()
    ->whereKey($keys)
    ->orderByField('id', $keys)
    ->get();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mikaël Popowicz](https://github.com/mikaelpopowicz)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1228d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5689944?v=4)[Mikaël Popowicz](/maintainers/mikaelpopowicz)[@mikaelpopowicz](https://github.com/mikaelpopowicz)

![](https://avatars.githubusercontent.com/u/2086576?v=4)[Charaf Rezrazi](/maintainers/Rezrazi)[@Rezrazi](https://github.com/Rezrazi)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![mikaelpopowicz](https://avatars.githubusercontent.com/u/5689944?v=4)](https://github.com/mikaelpopowicz "mikaelpopowicz (2 commits)")

---

Tags

laraveloneduolaravel-order-by-field

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/oneduo-laravel-order-by-field/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.2k2](/packages/wnx-laravel-backup-restore)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17558.6k](/packages/lacodix-laravel-model-filter)

PHPackages © 2026

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