PHPackages                             denmarty/marty-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. [Database &amp; ORM](/categories/database)
4. /
5. denmarty/marty-query-filter

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

denmarty/marty-query-filter
===========================

Reusable query filter pipeline for Laravel Eloquent builders.

1.0.0(1mo ago)0143MITPHPPHP ^8.2

Since May 4Pushed 1mo agoCompare

[ Source](https://github.com/denmarty-dev/marty-query-filter)[ Packagist](https://packagist.org/packages/denmarty/marty-query-filter)[ RSS](/packages/denmarty-marty-query-filter/feed)WikiDiscussions main Synced 1w ago

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

MartyQueryFilter
================

[](#martyqueryfilter)

Reusable query filter pipeline for Laravel Eloquent builders.

Features
--------

[](#features)

- simple `QueryFilter` contract for custom filters
- `FilterPipeline` with Laravel container resolution
- built-in `search` filter
- relation-aware filters through `whereHas(...)`
- normalized filter keys through `Str::snake(...)`
- support for inline filter configuration and legacy parameter registry

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12

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

[](#installation)

```
composer require denmarty/marty-query-filter
```

Laravel package discovery is supported automatically.

Core idea
---------

[](#core-idea)

You register allowed filters once, then pass request data into the pipeline.

Each filter:

- has a public input key such as `status`, `auction_name`, `year_of_release`
- points to a class that implements `QueryFilter`
- can optionally receive extra constructor parameters
- can optionally be applied inside a relation

QueryFilter contract
--------------------

[](#queryfilter-contract)

Every custom filter must implement `Denmarty\MartyQueryFilter\QueryFilter`.

```
