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

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

enimiste/laravel-eloquent-filters
=================================

Apply filters on laravel eloquent models easy

v5.5.0(8y ago)241.6k4MITPHPPHP &gt;=7.0

Since Oct 31Pushed 8y ago2 watchersCompare

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

READMEChangelogDependencies (3)Versions (2)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

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3117d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43e7310829d4711c88c34476daec986374515494fa1db2893f33d9091cc25a1a?d=identicon)[nouni.elbachir](/maintainers/nouni.elbachir)

---

Top Contributors

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

---

Tags

eloquentlaravelphp

### Embed Badge

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

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

###  Alternatives

[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[jerome/filterable

Streamline dynamic Eloquent query filtering with seamless API request integration and advanced caching strategies.

19226.1k](/packages/jerome-filterable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[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)
