PHPackages                             stobys/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. [Framework](/categories/framework)
4. /
5. stobys/laravel-filterable

ActiveProject[Framework](/categories/framework)

stobys/laravel-filterable
=========================

The Laravel filterable trait.

1.0.1(6y ago)014MITPHPPHP ^7.2

Since Mar 15Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Laravel Filterable Trait
========================

[](#laravel-filterable-trait)

Filterable trait for Laravel models. Slightly inspired by [n7olkachev/laravel-filterable](https://github.com/n7olkachev/laravel-filterable).

**Version**: 1.0.1

How it works
------------

[](#how-it-works)

In POST request, it looks for form fields defained in trait property `filterable_fields` and filter model by them. If model has defained scope with name of form field it uses that scope.

One can use it in this way:

```
\App\User::filter()->get()
```

As for now, it can filer collection by three methods - exact filter (is), like filter (like) and range filter (between).

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

[](#installation)

You can install the package via composer:

```
composer require stobys/laravel-filterable
```

Next, add Filterable trait and list all filterable properties:

```
use Filterable;

protected $filterable_fields = [
	'id'			=> 'is',
	'username'		=> 'like',
	'created_at'	=> 'between',
	'created_after'	=> 'scope'
];
```

And voila!

Examples
--------

[](#examples)

```
class User extends Model
{
    use Filterable;

    protected $filterable_fields = [
        'id'    => 'is',
        'username'    => 'like',
        'created_at'  => 'between',
        'created_after' => 'scope'
    ];

    public function scopeCreatedAfter($query, $time)
    {
        return $query->where('created_at', '>', $time);
    }
}
```

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Total

2

Last Release

2246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4be8a510a0cea4e428199c41d707670449959e810ede323a07ba551e3dc13782?d=identicon)[stobys](/maintainers/stobys)

---

Top Contributors

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

---

Tags

frameworklaravelfilterable

### Embed Badge

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

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

###  Alternatives

[bytefury/crater

Free &amp; Open Source Invoice App for Individuals &amp; Small Businesses. https://craterapp.com

8.3k4.2k](/packages/bytefury-crater)[hemp/presenter

Easy Model Presenters in Laravel

247592.6k1](/packages/hemp-presenter)[lms-laravel/lms-laravel

The Laravel Framework.

4981.8k](/packages/lms-laravel-lms-laravel)[rahulalam31/laravel-abuse-ip

Block ip address of all spammer's around the world.

27431.5k](/packages/rahulalam31-laravel-abuse-ip)

PHPackages © 2026

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