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(11mo ago)044MITPHPPHP ^8.2.12CI passing

Since Aug 29Pushed 11mo agoCompare

[ Source](https://github.com/pouyafarshidnia/elefilter)[ Packagist](https://packagist.org/packages/elefilter/elefilter)[ GitHub Sponsors](https://github.com/Rottmayer89)[ RSS](/packages/elefilter-elefilter/feed)WikiDiscussions master Synced 1w 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

27

—

LowBetter than 46% of packages

Maintenance50

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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

354d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/101319140?v=4)[Pouya Farshidnia](/maintainers/pouyafarshidnia)[@pouyafarshidnia](https://github.com/pouyafarshidnia)

---

Top Contributors

[![pouyafarshidnia](https://avatars.githubusercontent.com/u/101319140?v=4)](https://github.com/pouyafarshidnia "pouyafarshidnia (3 commits)")[![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

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.3M27](/packages/yajra-laravel-oci8)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k35.7M52](/packages/kirschbaum-development-eloquent-power-joins)[glushkovds/phpclickhouse-laravel

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

2051.6M2](/packages/glushkovds-phpclickhouse-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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