PHPackages                             thejano/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. [Database &amp; ORM](/categories/database)
4. /
5. thejano/laravel-filterable

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

thejano/laravel-filterable
==========================

Add filtration functionality to Laravel Models

2.0.0(3d ago)753.4k↓90.5%4[1 PRs](https://github.com/thejano/laravel-filterable/pulls)MITPHPPHP ^8.2CI passing

Since Jun 26Pushed 2mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (22)Versions (20)Used By (0)

Laravel Filterable
==================

[](#laravel-filterable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/74d029f758dd3c307950ca71005efa9a2324b96e731812a6b83b8df1959be270/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656a616e6f2f6c61726176656c2d66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thejano/laravel-filterable)[![GitHub Tests Action Status](https://github.com/thejano/laravel-filterable/actions/workflows/run-tests.yml/badge.svg)](https://github.com/thejano/laravel-filterable/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://github.com/thejano/laravel-filterable/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/thejano/laravel-filterable/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/1ce618e942c12173b0c61896279d9892ddab7fda2c32469499f91b85c2220dce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468656a616e6f2f6c61726176656c2d66696c74657261626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thejano/laravel-filterable)

This package adds filtration functionality to Laravel Models. It would be based on Filterable and Query Filter classes. The package will provide commands to generate Filterable and Query Filter classes. By default, it will add some default filtration out of the box to you models like ordering, get data between two dates and more.

Imagine you have a url containing the following parameters:

```
/posts?slug=the-new-web&published=true&category=web-development&tags[]=web&tags[]=laravel&tags[]=flutter
```

Laravel request all method `request()->all()` will return something like this:

```
[
    "slug"        => "the-new-web",
    "published"   => "true",
    "category"    => "web-development",
    "tags"        => [ "web", "laravel", "flutter"],
]
```

Normally, you should do the logic one by one to perform the filtration

```
