PHPackages                             sufian/laravel-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. [Search &amp; Filtering](/categories/search)
4. /
5. sufian/laravel-query-filter

ActiveLibrary[Search &amp; Filtering](/categories/search)

sufian/laravel-query-filter
===========================

A Laravel package to filter queries based on model properties.

v0.1.0(1y ago)09MITPHPPHP &gt;=7.4

Since Jun 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Rubel-CSTE/laravel-query-filter)[ Packagist](https://packagist.org/packages/sufian/laravel-query-filter)[ RSS](/packages/sufian-laravel-query-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Query Filter
====================

[](#laravel-query-filter)

A Laravel package to filter Eloquent queries based on model properties.

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

[](#installation)

### Step 1: Install the Package

[](#step-1-install-the-package)

You can install the package via Composer:

```
composer require sufian/laravel-query-filter
```

Usage
-----

[](#usage)

### Step 1: Use the Filterable Trait

[](#step-1-use-the-filterable-trait)

Add the Filterable trait to the Eloquent models you want to filter:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Sufian\QueryFilter\Filterable;

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

### Step 2: Create Filter Classes

[](#step-2-create-filter-classes)

To generate a new filter class, use the make:filter Artisan command followed by the name of the class you want to create. For example, to create a filter class for the User model, run:

```
php artisan make:filter YourModel Name
```

Example:

```
php artisan make:filter User
```

OR Create filter classes in the App\\Filters namespace for each model manually:

Example UserFilter Class

```
namespace App\Filters;

use Sufian\QueryFilter\BaseFilter;
use Illuminate\Database\Eloquent\Builder;

class UserFilter extends BaseFilter
{
    protected $filters = ['name', 'email'];

    public function name(Builder $query, $value)
    {
        $query->where('name', 'like', '%' . $value . '%');
    }

    public function email(Builder $query, $value)
    {
        $query->where('email', 'like', '%' . $value . '%');
    }
}
```

### Step 3: Use the Filter in Controllers

[](#step-3-use-the-filter-in-controllers)

You can now use the filter method in your controllers:

UserController

```
namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
    public function index(Request $request)
    {
        $users = User::filter()->get();
        return response()->json($users);
    }
}
```

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

[](#contributing)

Thank you for considering contributing to the Laravel Query Filter package! Please read the contribution guidelines for details on how to contribute.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within this Laravel Query Filter package, please send an e-mail to sufian at . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

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

702d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/31ad1a58fc0198031f9cddf0c00f947907274953c6439ef5a1ac4b1535c56b90?d=identicon)[Rubel-CSTE](/maintainers/Rubel-CSTE)

---

Top Contributors

[![sufianrubel](https://avatars.githubusercontent.com/u/80996172?v=4)](https://github.com/sufianrubel "sufianrubel (8 commits)")

### Embed Badge

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

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M202](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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