Download the PHP package ericgansa/filter-manager-bundle without Composer
On this page you can find all versions of the php package ericgansa/filter-manager-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package filter-manager-bundle
FilterManagerBundle
Symfony bundle for dynamic filtering, pagination and user-scoped queries with Doctrine ORM.
Supports a friendly query string notation:
Requirements
- PHP 8.2+
- Symfony 6.4 or 7.x
- Doctrine ORM 2.15+ or 3.x
Security is optional. The bundle works without symfony/security-bundle. When SecurityBundle is not installed, user-scoped filtering (mine/others) is silently disabled.
Installation
Register the bundle in config/bundles.php (auto-registered via Symfony Flex):
Configuration
Create config/packages/filter_manager.yaml:
Usage
1. In a Repository (via trait)
2. In a Controller
3. Manual usage (without the trait)
Query String Reference
Example Entity
The following examples are based on this Article entity:
All query string examples in this section filter against this entity. The label relation points to a Label entity with its own label string field. The user field is used by the scope system to determine ownership.
Equality
Filter results where a field exactly matches a value.
| Example | Result |
|---|---|
?id=5 |
Returns the item whose id is exactly 5 |
?description=Gestion agile... |
Returns items with that exact description |
LIKE (partial match)
Filter results where a field contains a substring. Two syntaxes are supported and produce identical results.
| Syntax | Example | Notes |
|---|---|---|
Inline (with %) |
?description=%Expert% |
Use % as wildcard directly in the value |
| Array | ?description[like]=Expert |
Cleaner syntax, no need for % |
Greater Than
Filter results where a numeric (or date) field is strictly greater than a value. Two syntaxes are supported.
| Syntax | Example | Notes |
|---|---|---|
| Inline | ?id=>5 |
Prefix value with > |
| Array | ?id[after]=5 |
Uses the [after] key |
Less Than
Filter results where a numeric (or date) field is strictly less than a value. Two syntaxes are supported.
| Syntax | Example | Notes |
|---|---|---|
| Inline | ?id=<6 |
Prefix value with < |
| Array | ?id[before]=6 |
Uses the [before] key |
Greater Than or Equal
Filter results where a field is greater than or equal to a value.
Less Than or Equal
Filter results where a field is less than or equal to a value.
Range (BETWEEN)
Filter results where a field falls within an inclusive range. Two syntaxes are supported.
| Syntax | Example | Notes |
|---|---|---|
| Inline | ?id=3..7 |
Separate bounds with .. |
| Array | ?id[between]=3..7 |
Uses the [between] key |
Relation Filtering
Filter on a field belonging to a related entity. Use the -> notation to traverse the relation.
⚠️ Important: Always use
->to separate the relation from the field name (e.g.label->label). Do not use.— PHP automatically converts.to_in query strings, which causes a Doctrine error.
| Example | Notes |
|---|---|
?label->label=Développeur PHP |
Exact match on the related field |
?label->label[like]=Développeur |
LIKE match on the related field |
Date Filtering
Filter results by date using [after] and [before]. Values must be ISO 8601 date strings. The field must be of type DateTimeImmutable (or compatible).
| Example | Notes |
|---|---|
?createdAt[after]=2026-01-01 |
Items created after January 1st 2026 |
?createdAt[before]=2020-01-01 |
Items created before January 1st 2020 |
Scope (User-based filtering)
Restrict results based on ownership. Requires symfony/security-bundle to be installed and a logged-in user. The entity must have a field pointing to the owner (configured via scope_field).
| Value | Behaviour |
|---|---|
mine |
Returns only items belonging to the currently authenticated user |
others |
Returns only items not belonging to the current user |
all |
No user filter applied (default behaviour) |
Chaining Filters
All filters can be combined freely in a single query string. Each parameter is applied as an additional AND condition on the query.
This example returns items that:
- have a related label containing
"Développeur", - have an
idof3or more, - were created after January 1st 2026,
- and belong to the currently authenticated user.
You can mix inline and array syntaxes freely:
There is no limit to the number of filters that can be chained.
License
MIT © Eric Gansa
All versions of filter-manager-bundle with dependencies
doctrine/orm Version ^2.15 || ^3.0
symfony/config Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.0
symfony/http-foundation Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.0