PHPackages                             oscabrera/laravel-query-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. oscabrera/laravel-query-filters

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

oscabrera/laravel-query-filters
===============================

A Laravel package for advanced query filtering and conditions.

v1.0.3(4mo ago)0684[1 issues](https://github.com/Oscabrera/laravel-query-filters/issues)1MITPHPPHP ^8.1

Since Jun 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/Oscabrera/laravel-query-filters)[ Packagist](https://packagist.org/packages/oscabrera/laravel-query-filters)[ Docs](https://github.com/Oscabrera/laravel-query-filters)[ RSS](/packages/oscabrera-laravel-query-filters/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (1)

Laravel Query Filters
=====================

[](#laravel-query-filters)

A Laravel package for advanced query filtering and conditions.

[![Latest Version on Packagist](https://camo.githubusercontent.com/1294c8cc02dddc4c136a8decbb3f48d011687413bc1b986bd766905cda2dbae1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f73636162726572612f6c61726176656c2d71756572792d66696c746572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oscabrera/laravel-query-filter)[![Total Downloads](https://camo.githubusercontent.com/a674934eb60aa4d8194aeef48dbe7b0e08391751b56f83409bb13a4112618ad5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f73636162726572612f6c61726176656c2d71756572792d66696c746572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oscabrera/laravel-query-filters)

[![VitePress](https://github.com/oscabrera/laravel-query-filters/actions/workflows/deploy.yml/badge.svg)](https://github.com/oscabrera/laravel-query-filters/actions/workflows/deploy.yml)[![Code Analysis](https://github.com/Oscabrera/laravel-query-filters/actions/workflows/pr-feature.yml/badge.svg)](https://github.com/Oscabrera/laravel-query-filters/actions/workflows/pr-feature.yml)

[![built with Codeium](https://camo.githubusercontent.com/c077f56a19fff290283d9bc7304591176ee195d4b66d13e5bc6d77a62cabc776/68747470733a2f2f636f646569756d2e636f6d2f6261646765732f6d61696e)](https://codeium.com)

[![laravel-query-filters](https://camo.githubusercontent.com/3e124c37df8aec3bd275adb3bb7bc09d0c8a788cd16107888a2d5201d614f478/68747470733a2f2f736f6369616c6966792e6769742e63692f4f73636162726572612f6c61726176656c2d71756572792d66696c746572732f696d6167653f6c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d466c6f6174696e67253230436f6773267468656d653d4175746f)](https://camo.githubusercontent.com/3e124c37df8aec3bd275adb3bb7bc09d0c8a788cd16107888a2d5201d614f478/68747470733a2f2f736f6369616c6966792e6769742e63692f4f73636162726572612f6c61726176656c2d71756572792d66696c746572732f696d6167653f6c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d466c6f6174696e67253230436f6773267468656d653d4175746f)

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

[](#installation)

Install the package via Composer:

```
composer require oscabrera/laravel-query-filters
```

Configuration (Optional)
------------------------

[](#configuration-optional)

You can publish the configuration file to customize the method name used for applying filters. This is optional, but it provides additional flexibility.

Publish the configuration file:

```
php artisan vendor:publish --provider="Oscabrera\QueryFilters\QueryFiltersServiceProvider" --tag="config"
```

This will create a `config/query-filters.php` file in your Laravel application. You can modify this file to change the method name:

```
return [
    /*
     * The name of the macro that is added to the Eloquent query builder.
     */
    'method_name' => 'applyFilters',
];
```

Usage
-----

[](#usage)

Here's an example of how to use the QueryFilters in a controller:

```
use Oscabrera\QueryFilters\Utilities\QueryFilters;
use App\Models\User;
use Illuminate\Http\Request;

public function index(Request $request)
{
    $conditions = [
        'name' => 'John',
        'age' => ['age', '>', 25],
        'status' => ['active', 'pending'],
        'role' => [
            'subQuery' => function($query) {
                return $query->select('id') ->from('roles') ->where('name', 'admin');
            },
            'not' => false,
        ]
    ];
    $queryFilters = new QueryFilters($conditions);
    $users = User::query()->applyFilters($queryFilters)->get();

    return response()->json($users);
}
```

Features
--------

[](#features)

- **Simple Conditions**: Apply simple equality conditions.
- **Array Conditions**: Use whereIn conditions for columns.
- **Triple Conditions**: Apply conditions with specific operators.
- **SubQueries**: Use subqueries for complex filtering.
- **Customizable Method Name**: Change the method name for applying filters via configuration.

More Information
----------------

[](#more-information)

For more information, visit the [documentation](https://oscabrera.github.io/laravel-query-filters).

By following these instructions, you can easily integrate advanced query filtering into your Laravel applications, customize the filtering method name, and keep your code clean and maintainable.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance75

Regular maintenance activity

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% 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 ~113 days

Recently: every ~141 days

Total

6

Last Release

140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e0ea8749a90d02e11df1982e9511900ba0367457cab975aaf050c5e9f1f733d?d=identicon)[oscabrera](/maintainers/oscabrera)

---

Top Contributors

[![oscabreraCP](https://avatars.githubusercontent.com/u/203874265?v=4)](https://github.com/oscabreraCP "oscabreraCP (20 commits)")[![Oscabrera](https://avatars.githubusercontent.com/u/19786377?v=4)](https://github.com/Oscabrera "Oscabrera (16 commits)")

---

Tags

laraveldatabaseeloquentqueryfilterrepositoryconditionsadvanced queries

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/oscabrera-laravel-query-filters/health.svg)

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

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[czim/laravel-filter

Filter for Laravel Eloquent queries, with support for modular filter building

8973.0k3](/packages/czim-laravel-filter)[littlebug/laravel-repository

The repository mode for laravel!

364.1k](/packages/littlebug-laravel-repository)

PHPackages © 2026

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