PHPackages                             krenor/eloquent-filter - 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. krenor/eloquent-filter

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

krenor/eloquent-filter
======================

Filtering Laravel Eloquent queries with ease!

1.0.0(10y ago)546[1 issues](https://github.com/krenor/eloquent-filter/issues)MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/90e2b164629e1a76dc7b7274646560b76d64b3caaa3dd63e488a873e00186d9a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b72656e6f722f656c6f7175656e742d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/krenor/eloquent-filter)[![License](https://camo.githubusercontent.com/cb8027f275c9644886e89c3ea9dd626bad583f51cdfb09bf7b49b0f73fdc638b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b72656e6f722f656c6f7175656e742d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/krenor/eloquent-filter)

eloquent-filter
===============

[](#eloquent-filter)

Simple and easy filtering an Eloquent Query of [Laravel 5.1](http://laravel.com/) with Inputs!

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

[](#installation)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

Add to your root composer.json and install with `composer install` or `composer update`

```
{
  "require": {
    "krenor/eloquent-filter": "~1.0.0"
  }
}

```

or use `composer require krenor/eloquent-filter` in your console.

### Step 2: Import the Trait

[](#step-2-import-the-trait)

In the Model you want to listen to Inputs, and automatically
filter them down by that input, just use and add the Trait.

```
namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;
use Krenor\EloquentFilter\FilterableTrait;

class Order extends Model
{
	use FilterableTrait;

    ...
}
```

Usage
-----

[](#usage)

Add a `protected $filterable = []` to the Model using the Trait.

1. **Column Names**

    - Correspond to the **column name** in the URL and filter down by that.
        URL : */some\_orders/all?status\_id=2*
        `protected $filterable = [ 'status_id' ]`
2. **Aliases**

    1. Use an **column alias** instead for *nice names*.
        URL : */some\_orders/all?status=2*
        `protected $filterable = [ 'status_id' => 'status' ]`
    2. Add **values aliases** to a column alias.
        URL : */some\_orders/all?status=processing*

    ```
    protected $filterable = [
        // column name => column alias
        'status_id' => ['status' => [
            // value aliases in database => input value
            1 => 'pending',
            2 => 'processing',
            3 => 'completed'
        ]
    ]
    ```

Now each time you run a query like `Order::with('relation1')->paginate()`
the filter is automatically applied and checks for the Inputs in the URL.
Note that this package **currently only supports the equal operator** for filtering a query down.

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

[](#contributing)

If you believe you have found an issue, please report it using the [GitHub issue tracker](https://github.com/krenor/eloquent-filter/issues),
or better yet, fork the repository and submit a [pull request](https://github.com/krenor/eloquent-filter/blob/master/CONTRIBUTING.md).

Licence
-------

[](#licence)

eloquent-filter is distributed under the terms of the [MIT license](https://github.com/krenor/ldap-auth/blob/master/LICENSE.md)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

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

3940d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13726968?v=4)[Stan](/maintainers/Krenor)[@krenor](https://github.com/krenor)

---

Top Contributors

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

---

Tags

laraveleloquentlaravel 5input filterquery-filterlaravel-querykrenor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/krenor-eloquent-filter/health.svg)

```
[![Health](https://phpackages.com/badges/krenor-eloquent-filter/health.svg)](https://phpackages.com/packages/krenor-eloquent-filter)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11222.5M32](/packages/anourvalar-eloquent-serialize)[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

854.1k](/packages/waad-laravel-model-metadata)[mozex/laravel-scout-bulk-actions

Import, flush, and queue-import all your Laravel Scout searchable models at once. Auto-discovers models, runs in bulk, tracks progress.

1437.7k](/packages/mozex-laravel-scout-bulk-actions)[binafy/laravel-reactions

React to something in Laravel framework

875.6k](/packages/binafy-laravel-reactions)[stayallive/laravel-eloquent-observable

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

2933.4k9](/packages/stayallive-laravel-eloquent-observable)[dannyweeks/laravel-base-repository

An abstract repository class for your Eloquent repositories that requires minimal config to get started.

202.0k](/packages/dannyweeks-laravel-base-repository)

PHPackages © 2026

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