PHPackages                             aidynmakhataev/laravel-filterable - 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. aidynmakhataev/laravel-filterable

ActiveLibrary

aidynmakhataev/laravel-filterable
=================================

A laravel package to handle filtering by URL query strings

1.0.0(7y ago)2441MITPHP

Since Jul 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/AidynMakhataev/laravel-filterable)[ Packagist](https://packagist.org/packages/aidynmakhataev/laravel-filterable)[ Docs](https://github.com/aidynmakhataev/laravelfilterable)[ RSS](/packages/aidynmakhataev-laravel-filterable/feed)WikiDiscussions master Synced today

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

LaravelFilterable
=================

[](#laravelfilterable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6c658a7d531eb69598dc406b5ab3fc0a40138791b4ea09357ef3e35723f164ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616964796e6d616b6861746165762f6c61726176656c66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aidynmakhataev/laravel-filterable)[![Total Downloads](https://camo.githubusercontent.com/d524291508ff779fbb898edad1567a53f5f5d43bc83fc66f5f45a40594b3485f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616964796e6d616b6861746165762f6c61726176656c66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aidynmakhataev/laravel-filterable)[![Build Status](https://camo.githubusercontent.com/f85ea709ada6bd5c479214db62dd487e50786eb3b1a4721b59f0c5c700ccb065/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616964796e6d616b6861746165762f6c61726176656c66696c74657261626c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/aidynmakhataev/laravelfilterable)[![StyleCI](https://camo.githubusercontent.com/71c85b5a31ef6f38eef24cc67c25d4efc3cbe305805919040250951107b60d32/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133393638333937332f736869656c64)](https://github.styleci.io/repos/139683973)

A laravel package to handle filtering by URL query strings

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

[](#installation)

Via Composer

```
$ composer require aidynmakhataev/laravel-filterable
```

Usage
-----

[](#usage)

1. Create a new filter with the following artisan command:

```
php artisan make:filter UserFilter
```

This will create `App\Http\Filters\UserFilter.php`. You can override the default namespace in **`config/filterable.php`**

```
return [

    /*
    |--------------------------------------------------------------------------
    | Filters Configuration
    |--------------------------------------------------------------------------
    |
    */

    // namespace for the generated filters
    'namespace' =>  'App\Http\Filters'
];
```

Then, you need to define your filter logic by following this rules:

- Query string without a corresponding filter method are ignored
- Empty strings are ignored
- The value of the each request keys are injected into the corresponding filter method
- You are able to access the eloquent query builder instance by using `$this->builder`

**Example**:

For defining methods for the following url request:

`http://yourdomain.com/api/users?gender=male&working=1 `

You would use the following methods:

```
namespace App\Http\Filters;

use AidynMakhataev\LaravelFilterable\BaseFilter;

class UserFilter extends BaseFilter
{
    public function gender($value)
    {
        return $this->builder->where('gender', $value);
    }

    public function working($value)
    {
        return $this->builder->where('is_working', $value);
    }
}
```

2. Add the trait and bind created in step 1 Filter Class to your model.

```
use AidynMakhataev\LaravelFilterable\Filterable;

class User extends Authenticatable
{
   use Filterable;

   /**
    * Filters attribute.
    *
    * @var array
    */
   protected $filters = \App\Http\Filters\UserFilter::class;

}
```

3. Finally, use it in your Controller:

```
namespace App\Http\Controllers;

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

class UserController extends Controller
{
    public function index(Request $request)
    {
        $users = User::filter($request->all())->get();

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

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

[](#contributing)

Anyone is welcome to contribute. Fork, make your changes, and then submit a pull request.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Aidyn Makhataev](https://github.com/AidynMakhataev)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

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

Unknown

Total

1

Last Release

2869d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05bd73f86bccc02a979273fd6b74f2573e3f3c1d2120a879a15c74d8d6abbf63?d=identicon)[AidynMakhataev](/maintainers/AidynMakhataev)

---

Top Contributors

[![AidynMakhataev](https://avatars.githubusercontent.com/u/19181566?v=4)](https://github.com/AidynMakhataev "AidynMakhataev (9 commits)")

---

Tags

filterablefilteringlaravellaravel-5-packagelaravel-filterphpquery-filterlaravelLaravelFilterable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aidynmakhataev-laravel-filterable/health.svg)

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

###  Alternatives

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[glhd/linen

21135.6k](/packages/glhd-linen)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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