PHPackages                             kdabrow/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. kdabrow/filters

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

kdabrow/filters
===============

Filters for the Laravel API

v2.0.0(3mo ago)018MITPHPPHP &gt;=8.2.0CI passing

Since Aug 16Pushed 3mo agoCompare

[ Source](https://github.com/karoldabro/filters)[ Packagist](https://packagist.org/packages/kdabrow/filters)[ RSS](/packages/kdabrow-filters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Laravel Filters
===============

[](#laravel-filters)

A powerful filtering package for Laravel Eloquent models with support for dynamic queries, custom filters, nested conditions, ordering, and column aliases.

Features
--------

[](#features)

- **Laravel Model Integration**: Direct filtering with `$model->filter()`
- **URL-based Filtering**: `GET /users?f[0][c]=name&f[0][o]=like&f[0][v]=John`
- **Ordering Support**: `GET /users?o[0][c]=created_at&o[0][v]=desc`
- **Column Aliases**: Hide real database columns from your API
- **JSON Column Support**: Filter and order by JSON paths (`data->type`, `data->meta->category`)
- **Filter &amp; Order Callbacks**: Override query logic per column with closures or invocable classes
- **Advanced Operators**: `=`, `!=`, `>`, `=`, ` ['allowedOperators' => ['=']]
```

And your API consumers send `like` queries on `name`, update the config:

```
'name' => ['allowedOperators' => ['=', 'like']]
```

Models that do not implement `Filterable` (using `$fillable` only) are **not affected** — all global operators remain available.

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

[](#installation)

```
composer require kdabrow/filters
```

The package includes Laravel integration out of the box. The service provider is auto-discovered.

#### Publish Configuration (Optional)

[](#publish-configuration-optional)

```
php artisan vendor:publish --tag=filters-config
```

Quick Start
-----------

[](#quick-start)

Add the trait to your model and start filtering:

```
