PHPackages                             geeckon/laravel-eloquent-filters - 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. geeckon/laravel-eloquent-filters

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

geeckon/laravel-eloquent-filters
================================

Apply filters on laravel eloquent models easy

8.0.1(3y ago)05MITPHPPHP &gt;=7.4

Since Dec 16Pushed 3y agoCompare

[ Source](https://github.com/geeckon/laravel-eloquent-filters)[ Packagist](https://packagist.org/packages/geeckon/laravel-eloquent-filters)[ RSS](/packages/geeckon-laravel-eloquent-filters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Laravel 5.5 eloquent models filters
-----------------------------------

[](#laravel-55-eloquent-models-filters)

### Install

[](#install)

Require this package with composer using the following command:

```
composer require "enimiste/laravel-eloquent-filters:5.5.*"
```

### Usage :

[](#usage-)

Use the trait `Com\NickelIT\Filterables\Filterable` in your eloquent model.
Create a new class by extending the class `Com\NickelIT\Filterables\QueryFilters` and define your custom filters as methods with one argument. Where function names are the filter argument name and the arguments are the value.
Example :

```
use Illuminate\Database\Eloquent\Builder;

class LessonQueryFilters extends QueryFilters
{
    /**
     * @param string $order
     * @return Builder
     */
    public function popular($order = 'desc'): Builder
    {
        return $this->builder()->orderBy('views', $order);
    }

    /**
     * @param $level
     * @return Builder
     */
    public function difficulty($level): Builder
    {
        return $this->builder()->where('difficulty', $level);
    }

    /**
     * @param string $order
     * @return Builder
     */
    public function length($order = 'asc'): Builder
    {
        return $this->builder()->orderBy('length', $order);
    }
}
```

With this class we can use the http query string : `popular=desc&difficulty=beginner&length` or any combination of these filters. It is up to you to define if you will use AND wheres or OR.
In the controller you can apply these filters like :

```
class LessonController extends Controller
{
    /**
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request)
    {
        $bag = new HttpRequestFiltersBag($request);
        //$bag = new ArrayFiltersBag(['popular' => 'asc', 'difficulty' => 'beginner']);
        $filter = new LessonQueryFilters($bag);
        return Lesson::filter($filter)->get();//you can send results to a blade view
    }
}
```

### Thanks to :

[](#thanks-to-)

### License

[](#license)

The Laravel Eloquent Filters is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

1244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ef946e8e80b1a0f45ae530368fd5dd45ca26d11a56f0280a01a77f19e16617c?d=identicon)[geeckon](/maintainers/geeckon)

---

Top Contributors

[![enimiste](https://avatars.githubusercontent.com/u/2515677?v=4)](https://github.com/enimiste "enimiste (1 commits)")

### Embed Badge

![Health badge](/badges/geeckon-laravel-eloquent-filters/health.svg)

```
[![Health](https://phpackages.com/badges/geeckon-laravel-eloquent-filters/health.svg)](https://phpackages.com/packages/geeckon-laravel-eloquent-filters)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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