PHPackages                             bartlomiejbeta/filter-sorter-bundle - 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. bartlomiejbeta/filter-sorter-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

bartlomiejbeta/filter-sorter-bundle
===================================

v2.1.0(7y ago)0756MITPHPPHP ^7.0

Since Sep 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bartlomiejbeta/FilterSorterBundle)[ Packagist](https://packagist.org/packages/bartlomiejbeta/filter-sorter-bundle)[ RSS](/packages/bartlomiejbeta-filter-sorter-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (9)Versions (9)Used By (0)

FilterSorterBundle
==================

[](#filtersorterbundle)

This Symfony bundle aims to provide structurized filtering and sorting with usage of the specification pattern (see [doctrine-specification](https://github.com/Happyr/Doctrine-Specification)). It was design to use in the api applications but it could be also used with standard web apps.

##### Provides feature like:

[](#provides-feature-like)

- `FilterQueryManager` - it collects all `filter services` and gives you queryBuilder with applied specifications.
- `FilterParamConverter` - provide `filter object` by the data in query string
- `SortParamConverter` - provide `sort object` by the data in query string

[![Build Status](https://camo.githubusercontent.com/84beca922641ceb6db40b5aef50295b873e4393562f65a6245ab621e3ed75635/68747470733a2f2f7472617669732d63692e6f72672f626172746c6f6d69656a626574612f46696c746572536f7274657242756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/bartlomiejbeta/FilterSorterBundle)

### Installation

[](#installation)

##### 1. Install via composer:

[](#1-install-via-composer)

```
composer require bartlomiejbeta/filter-sorter-bundle

```

##### 2. Register bundle in `AppKernel`:

[](#2-register-bundle-in-appkernel)

```
public function registerBundles()
{
    $bundles = array(
        // ...
        new BartB\FilterSorterBundle\FilterSorterBundle(),
    );
}
```

### Usage

[](#usage)

I assume that you already have entities, and so one.

##### 1. Change parent of the entities to `AbstractEntitySpecificationAwareRepository`:

[](#1-change-parent-of-the-entities-to-abstractentityspecificationawarerepository)

example:

```
class CarRepository extends AbstractEntitySpecificationAwareRepository
{
}
```

##### 2. Add specifications ([example](https://github.com/bartlomiejbeta/FilterSorterBundleExample/tree/master/src/AppBundle/Repository/Specification))

[](#2-add-specifications-example)

##### 3. Add Collection filter ([example](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Data/Filter/CarCollectionFilter.php))

[](#3-add-collection-filter-example)

##### 4. Add Sort Enum ([example](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Data/Sort/CarSort.php))

[](#4-add-sort-enum-example)

##### 5. Build and register your first service adapter ([adapter example](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Service/Filter/Adapter/FilterCarAdapter.php), [register adapter example](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Resources/config/services.yml))

[](#5-build-and-register-your-first-service-adapter-adapter-example-register-adapter-example)

##### 5. Run ([standard](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Controller/DefaultController.php), [api with paramConverters](https://github.com/bartlomiejbeta/FilterSorterBundleExample/blob/master/src/AppBundle/Controller/GetCarController.php))

[](#5-run-standard-api-with-paramconverters)

```
$carCollectionFilter = (new CarCollectionFilter())->setGearboxType('automatic');

$carSorter     = new CarSort(CarSort::FUEL_TYPE);
$sortDirection = new SortDirectionType(SortDirectionType::DESC);

/** @var FilterQueryManager $filterQueryManager */
$filterQueryManager = $this->filterQueryManager;
$carRepository      = $this->repostioryCar;
$sort 	            = new Sort($sortDirection, $carSorter);
$limit              = new Limit(1);

$basicRepositoryDTO = new BasicRepositoryDTO($carRepository);
$queryAttributesDTO = new QueryAttributesDTO($carCollectionFilter, $sort, $limit);

$queryBuilder = $filterQueryManager->getQueryBuilder($basicRepositoryDTO, $queryAttributesDTO);
$query        = $queryBuilder->getQuery();
$result       = $query->execute();
```

TODO: Upgrade example to symfony 3.4 [Also I prepared full stand alone example](https://github.com/bartlomiejbeta/FilterSorterBundleExample)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

8

Last Release

2808d ago

Major Versions

v0.2.1 → v1.0.02018-02-18

v1.0.1 → v2.0.02018-08-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/74ae63f212d957f86bee321c97a221bc5a464d55ffe7871778bcf8ae17a685fc?d=identicon)[bartlomiejbeta](/maintainers/bartlomiejbeta)

---

Top Contributors

[![bartlomiejbeta](https://avatars.githubusercontent.com/u/17701206?v=4)](https://github.com/bartlomiejbeta "bartlomiejbeta (20 commits)")

---

Tags

specificationdoctrinefiltersorter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bartlomiejbeta-filter-sorter-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bartlomiejbeta-filter-sorter-bundle/health.svg)](https://phpackages.com/packages/bartlomiejbeta-filter-sorter-bundle)
```

###  Alternatives

[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[happyr/doctrine-specification

Specification Pattern for your Doctrine repositories

452915.0k8](/packages/happyr-doctrine-specification)[petkopara/crud-generator-bundle

Symfony3 bundle for CRUD generation with pagination, filtering, sorting, page size, bulk delete and bootstrap3 markup. This Generator supports Doctrine association mapping.

7257.9k](/packages/petkopara-crud-generator-bundle)[artprima/query-filter-bundle

An easy way to filter requests in your Symfony 4/5/6 application (that uses Doctrine2 as ORM).

2829.6k](/packages/artprima-query-filter-bundle)[rikbruil/doctrine-specification

Doctrine Specification pattern for building queries dynamically and with re-usable classes for composition.

50251.6k2](/packages/rikbruil-doctrine-specification)

PHPackages © 2026

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