PHPackages                             elefilter/elefilter - 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. elefilter/elefilter

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

elefilter/elefilter
===================

A filter package for laravel elequent models

v1.0.0-beta(8mo ago)023MITPHPPHP ^8.2.12CI passing

Since Aug 29Pushed 8mo agoCompare

[ Source](https://github.com/Rottmayer89/elefilter)[ Packagist](https://packagist.org/packages/elefilter/elefilter)[ GitHub Sponsors](https://github.com/Rottmayer89)[ RSS](/packages/elefilter-elefilter/feed)WikiDiscussions master Synced 1mo ago

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

[![EleFilter](https://camo.githubusercontent.com/d8b3f28374f487d17b584b4a04aad5aa267ee066cfcb708b815cf823dd494516/68747470733a2f2f656c6566696c7465722e706f757961666172736869646e69612e636f6d2f696d672f66696c7465722e706e67)](https://camo.githubusercontent.com/d8b3f28374f487d17b584b4a04aad5aa267ee066cfcb708b815cf823dd494516/68747470733a2f2f656c6566696c7465722e706f757961666172736869646e69612e636f6d2f696d672f66696c7465722e706e67)

EleFilter
=========

[](#elefilter)

### Easy and Clean Filter Package For Laravel Applications

[](#easy-and-clean-filter-packagefor-laravel-applications)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2aec27c4cc5f4d33e7e0782da9bfa93f9d9ac5c382bdd6b5cbec77ab419ee366/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6566696c7465722f656c6566696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elefilter/elefilter)[![Total Downloads](https://camo.githubusercontent.com/ba7b389e1b466b8473fdda44cb9114719290058ab6fc11f91846459e6dff423b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6566696c7465722f656c6566696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elefilter/elefilter)

**Elefilter** is a Laravel package that helps you easily create and organize **filter classes** for your Eloquent models.
It provides a simple Artisan command (`make:filter`) and a clean structure for building reusable filters.

👉 Full documentation available at: [here](https://elefilter.pouyafarshidnia.com)

---

Requirements
------------

[](#requirements)

- PHP **8.2+**

---

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

[](#installation)

Install the package via Composer:

```
composer require elefilter/elefilter
```

If you get stability error, use this command instead.(package is in beta version)

```
 composer require elefilter/elefilter:"1.0.0-beta"
```

---

Make model filterable
---------------------

[](#make-model-filterable)

Add Filterable Trait to the model

```
use EleFilter\Traits\Filterable;

class User extends Model
{
    use HasFactory, Filterable;
}
```

Create a class filter
---------------------

[](#create-a-class-filter)

With command make:filter, you can create a filter class for your model

```
php artisan make:filter User/Status --column=email_verified_at
```

Define query
------------

[](#define-query)

Inside filter class you can define the query conditions inside methods

```
namespace App\Filters\User;

use EleFilter\Database\ModelFilter;

class StatusFilter extends ModelFilter
{
   protected string $column = "email_verified_at";

   public function verified(): void
   {
      $this->notNull();
   }

   public function unverified(): void
   {
      $this->null();
   }

}
```

Use filter method
-----------------

[](#use-filter-method)

When you want to get results, you can apply the filters like this:

```
$verifiedUsers = User::filter([ 'status'  => 'verified' ])->get();

$unverifiedUsers = User::filter([ 'status'  => 'unverified' ])->get();
```

Or use macro methods:

```
$verifiedUsers = User::verified()->get();

$unverifiedUsers = User::unverified()->get();
```

Filters with arguments
----------------------

[](#filters-with-arguments)

For filter which needs argument like search filter, you can use default apply method inside class filters :

```
namespace App\Filters\User;

use EleFilter\Database\ModelFilter;

class SearchFilter extends ModelFilter
{
   protected string $column = "email";

   public function apply(mixed $param): void
   {
      $this->like($param);
   }
}
```

And call it like this:

```
$users = User::filter(['search' => 'test'])->get();
```

Or use macro methods :

```
$users = User::search('test')->get();
```

In the front end side in your filter form, assign the class filter names (without suffix Filter) as name attribute for the inputs and values can be method names or the given parameter.An example is like this:

```

   oldest

   newest

      pending
      approved
      rejected

```

For detailed documentaion, more examples, possible conflics, limitation and testing, please refer to website.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance59

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

262d ago

### Community

Maintainers

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

---

Top Contributors

[![Rottmayer89](https://avatars.githubusercontent.com/u/101319140?v=4)](https://github.com/Rottmayer89 "Rottmayer89 (3 commits)")

---

Tags

eloquenteloquent-filtereloquent-filtersfilterlaravelmodelmodel-filtermodel-filterspackagephpqueryquery-builderquery-filterquery-filter-laravelquery-filtersphplaravelfilterlaravel filterelequentelequent-filtereasy-filterclean-filter

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/elefilter-elefilter/health.svg)

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

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2031.2M2](/packages/glushkovds-phpclickhouse-laravel)[io238/laravel-iso-countries

Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.

5462.3k](/packages/io238-laravel-iso-countries)[sebastiaanluca/laravel-boolean-dates

Automatically convert Eloquent model boolean attributes to dates (and back).

40111.7k1](/packages/sebastiaanluca-laravel-boolean-dates)

PHPackages © 2026

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