PHPackages                             faisal50x/query-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. faisal50x/query-filter

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

faisal50x/query-filter
======================

Laravel Eloquent models filter based on query parameters.

v1.0.6(2y ago)29353MITPHPPHP ^7.1|^7.2|^7.3|^7.4|^8.0|^8.1CI failing

Since Mar 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Faisal50x/query-filter)[ Packagist](https://packagist.org/packages/faisal50x/query-filter)[ Docs](https://github.com/faisal50x/query-filter)[ RSS](/packages/faisal50x-query-filter/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (7)Dependencies (5)Versions (10)Used By (0)

A elegant way to filter database based on query filter.
=======================================================

[](#a-elegant-way-to-filter-database-based-on-query-filter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c83c4c55cd303b4027fa6a3158655f966df579b20de262fe31e494007fa4bb55/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66616973616c3530782f71756572792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/faisal50x/query-filter)[![Build Status](https://camo.githubusercontent.com/c1a85cb80cfb0569340966922f8f0111400cd1aa2144bb4ad3435ecff7dbc21e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f66616973616c3530782f71756572792d66696c7465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/faisal50x/query-filter)[![Quality Score](https://camo.githubusercontent.com/1b8f09d2a3866ebab1a09d674cb779ecb20a937f8c0432ef2aa23bc2fd0e7ab3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66616973616c3530782f71756572792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/faisal50x/query-filter)[![Total Downloads](https://camo.githubusercontent.com/77b16890cbd3df0277eced6f86372b8f32934b8b4c1ca85a767a7672e192d49c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66616973616c3530782f71756572792d66696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/faisal50x/query-filter)

This is a simple package, It's can boost your productivity, make your code cleaner as well as simple.

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

[](#installation)

You can install the package via composer:

```
composer require faisal50x/query-filter
```

Usage
-----

[](#usage)

#### Before

[](#before)

```
 public function index($request){
    $query = User::query();
     if(request()->has('status')) {
        $query = $query->where('status', request()->get('status'));
     }
     if(request()->has('role')) {
        $query = $query->where('role', request()->get('role'));
     }
    $users = $query->get();
}
```

#### Now

[](#now)

```
public function index($request, UserFilter $filter){
    //It's nice and clean
    $users = User::filter($filter)->get();
}

// User Filter
use Faisal50x\QueryFilter\QueryFilter;

class UserFilter extends QueryFilter {

    public function status($query, $status){
        return $query->whereStatus($status);
    }

    public function role($query, $role){
        return $query->whereRole($role);
    }

}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Faisal Ahmed](https://github.com/faisal50x)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~317 days

Total

8

Last Release

937d ago

Major Versions

v1.0.5 → 2.0.x-dev2021-01-05

PHP version history (4 changes)v1.0.0PHP ^7.1

v1.0.1PHP ^7.1|^7.2

v1.0.5PHP ^7.1|^7.2|^7.3|^7.4|^8.0

v1.0.6PHP ^7.1|^7.2|^7.3|^7.4|^8.0|^8.1

### Community

Maintainers

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

---

Top Contributors

[![Foysal50x](https://avatars.githubusercontent.com/u/24409515?v=4)](https://github.com/Foysal50x "Foysal50x (17 commits)")

---

Tags

laraveleloquentqueryfiltersfaisal50xquery-filter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/faisal50x-query-filter/health.svg)

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

###  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)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[cerbero/query-filters

Filter Laravel Eloquent models based on query parameters.

85282.6k](/packages/cerbero-query-filters)[aldemeery/sieve

A simple, clean and elegant way to filter Eloquent models.

1396.3k](/packages/aldemeery-sieve)[baril/bonsai

An implementation of the Closure Tables pattern for Eloquent.

3593.5k](/packages/baril-bonsai)

PHPackages © 2026

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