PHPackages                             xaben/datafilter - 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. xaben/datafilter

ActiveLibrary

xaben/datafilter
================

A library that provides common interface for filtering data

013.7k—2.4%1PHP

Since Aug 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/xaben/datafilter)[ Packagist](https://packagist.org/packages/xaben/datafilter)[ RSS](/packages/xaben-datafilter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Filter
======

[](#filter)

Data filtering and pagination made easy.

The implementation is based on:

- having adapters for Input filter format. Contains 2 default implementations (DataTables and Api)
- formatters for the output format (DataTables, Api, Raw)
- adapters for the underlying DB (Doctrine ORM)

Every aspect can be extended as you see fit either by replacing the implementation or implementing the interfaces.

Creating your first filter
--------------------------

[](#creating-your-first-filter)

The bundle comes with 2 predefined input adapters:

- DataTables Adapter (`App\Filter\Adapter\DataTableAdapter`): for parsing requests from DataTables
- Api Adapter (`App\Filter\Adapter\ApiAdapter`): for Api requests

In order to get it working we need to do some setup first. 3 things are required:

- a filter definition
- a transformer
- a repository service

Each filter definition implements `App\Filter\Definition\FilterDefinitionInterface`, you can also use `App\Filter\Definition\BaseFilterDefinition` as a starting point. The base class expects 2 parameters:

- the repository service that implements `App\Filter\Repository\FilterableRepositoryInterface` there are 2 default implementations:

    - `App\Filter\Repository\DoctrineORMRepository`
    - `App\Filter\Repository\MongoRepository`
- the transformer that implements `App\Filter\Transformer\TransformerInterface`, normally you should extend:

    - for Api `App\Filter\Transformer\ApiAbstractTransformer`
    - for DataTables `App\Filter\Transformer\AbstractTransformer`

Normally both the transformer and the Filter Definition should be registered as services inside the app.

After that inside the controller it is as simple as:

```
use App\Filter\Adapter\DataTableAdapter;
use App\Filter\Definition\UserDefinition;
...
        return new JsonResponse(
            $this
                ->get(DataTableAdapter::class)
                ->process($this->get(UserDefinition::class), $request)
        );
...
```

**Hint:** you can inject your services as method parameters instead of getting them from the Controller.

Please check the following files for examples:

[Definition example](doc/example_definition.md)

[Transformer example](doc/example_transformers.md)

License
-------

[](#license)

This package is available under the [MIT license](LICENSE).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2345a6a545f326e574d5dcdd25d399656b6119809198b0e821424e5e6413dcf?d=identicon)[xaben](/maintainers/xaben)

### Embed Badge

![Health badge](/badges/xaben-datafilter/health.svg)

```
[![Health](https://phpackages.com/badges/xaben-datafilter/health.svg)](https://phpackages.com/packages/xaben-datafilter)
```

PHPackages © 2026

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