PHPackages                             instacar/extra-filters-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. [Search &amp; Filtering](/categories/search)
4. /
5. instacar/extra-filters-bundle

ActiveSymfony-bundle[Search &amp; Filtering](/categories/search)

instacar/extra-filters-bundle
=============================

A Symfony bundle for Api Platform with a composable and adaptative filter

v0.2.3(3y ago)916.2k↓16.7%3[3 PRs](https://github.com/InstacarMX/ExtraFiltersBundle/pulls)LGPL-3.0-onlyPHPPHP &gt;=8.1

Since Jul 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/InstacarMX/ExtraFiltersBundle)[ Packagist](https://packagist.org/packages/instacar/extra-filters-bundle)[ RSS](/packages/instacar-extra-filters-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (22)Versions (9)Used By (0)

Instacar\\ExtraFiltersBundle
============================

[](#instacarextrafiltersbundle)

A Symfony Bundle for API Platform to add a powerful filter based on Symfony Expressions, with support for virtual fields and composable filters.

Upgrading
---------

[](#upgrading)

This version is for API Platform 2.7 and 3.0 with PHP 8.1 and Symfony 6.1. If you use API Platform 2.6, PHP 7.4 or Symfony 5.4, you must use the [v1](/InstacarMX/ExtraFiltersBundle/tree/v1) of this package.

Before you go
-------------

[](#before-you-go)

This is a WIP (Work-In-Progress), so you must expect breaking changes with the release of a new version. This software will try to stick with the semver conventions (trying to don't introduce backward-incompatible changes with the release of new patch version), but I don't provide support for old versions.

Scope
-----

[](#scope)

This bundle is NOT:

- A client-side expression builder. You must define the properties and the expressions beforehand. If you want it, you can use [this awesome bundle by metaclass](https://github.com/metaclass-nl/filter-bundle/tree/query-expression-generator)(but it can open DDoS vectors in public APIs, [see this comment](https://github.com/api-platform/core/pull/2055#issuecomment-405308524)).

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

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require instacar/extra-filters-bundle
```

That's all! You can jump right to "Configuration".

### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require instacar/extra-filters-bundle
```

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Instacar\ExtraFiltersBundle\InstacarExtraFiltersBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

By default, the ExpressionFilter enable the API Platform filters by default (excluding OrderFilter), but you can enable your own filters using updating the configuration. Example:

```
# config/packages/instacar_extra_filters.yml
instacar_extra_filters:
  doctrine:
    filters:
      App\Filter\CustomFilter: true
```

You can also disable the API Platforms filters for the ExpressionFilter setting the value of the filter to "false". Example with all the available filters:

```
# config/packages/instacar_extra_filters.yml
instacar_extra_filters:
  doctrine:
    filters:
      ApiPlatform\Doctrine\Orm\Filter\SearchFilter: false
      ApiPlatform\Doctrine\Orm\Filter\RangeFilter: false
      ApiPlatform\Doctrine\Orm\Filter\DateFilter: false
      ApiPlatform\Doctrine\Orm\Filter\BooleanFilter: false
      ApiPlatform\Doctrine\Orm\Filter\NumericFilter: false
      ApiPlatform\Doctrine\Orm\Filter\ExistsFilter: false
```

Usage
-----

[](#usage)

You can implement the ExpressionFilter as a normal filter for API Platform. For example:

```
// src/Entity/Book.php

use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use Doctrine\ORM\Mapping as ORM;
use Instacar\ExtraFiltersBundle\Doctrine\Orm\Filter\ExpressionFilter;

#[ApiResource]
#[ApiFilter(ExpressionFilter::class, properties: [
    'search' => 'orWhere(search("name", "partial"), search("author.name", "partial"), search("year", "partial"))',
])]
#[ORM\Entity]
class Book {
    // real implementation
}
```

The expression syntax are the following:

```
['filter-property' => 'operator(filter1(property, strategy, value), filter2(property, strategy, value), ..., filterN(property, strategy, value))'];
```

Where:

- **filter-property:** The property used for filter in your API. You can use a virtual property (a property that is not present in your entity).
- **operator:** A [supported operator](#supported-operators).
- **filter:** A [supported filter](#supported-filters).
- **property:** The name of the property from the entity. You can use "property" if you want to use the same name from the filter-property.
- **strategy:** The strategy from the documented values in the filter's documentation. Optional. You can use "null" for use the follow parameter.
- **value:** The value passed to the filter. Optional. You can manipulate the value before pass it to the filter with this property, for example with the DateFilter you can search old dates with `{before: value}`.

### Allowed values

[](#allowed-values)

- **user:** Equal to the current Symfony user.
- **token:** Equal to the curren Symfony security token.

### Supported operators

[](#supported-operators)

- **andWhere:** Equal to the SQL operator "AND".
- **orWhere:** Equal to the SQL operator "OR".
- **notWhere:** Equal to the SQL operator "NOT".

### Supported filters

[](#supported-filters)

- All the filters for API Platform for the ORM (currently tested SearchFilter and DateFilter).
- Custom filters that implement the interface `FilterInterface` for the ORM. Note: The filter's name for the expression is in camelCase without the "Filter" suffix (for example, SearchFilter is converted to search).

Limitations
-----------

[](#limitations)

- It only works with the ORM filters.
- It does not generate a tailored documentation for API Platform, it only generates a generic property with the "string" value.

Future work
-----------

[](#future-work)

These are the list of the ideas that I have for this bundle. If you have another idea, let me know in the "Issues" tab.

- Working ODM filters with this filter.

Licensing
---------

[](#licensing)

This bundle is licensed under the GNU LGPLv3. For a quick resume of the permissions with this license see the [GNU LGPLv3](https://choosealicense.com/licenses/lgpl-3.0/) in [choosealicense.com](https://choosealicense.com).

See the [LICENSE](LICENSE.md) file for more details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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 ~31 days

Recently: every ~19 days

Total

6

Last Release

1252d ago

Major Versions

v0.2.0 → v1.x-dev2022-09-22

PHP version history (2 changes)v0.1.0PHP &gt;=7.4

v0.2.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/136378564?v=4)[Brandon Antonio](/maintainers/gtg-bantonio)[@gtg-bantonio](https://github.com/gtg-bantonio)

---

Top Contributors

[![BrandonlinU](https://avatars.githubusercontent.com/u/32807382?v=4)](https://github.com/BrandonlinU "BrandonlinU (36 commits)")[![ThomasCarbon](https://avatars.githubusercontent.com/u/116898217?v=4)](https://github.com/ThomasCarbon "ThomasCarbon (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/instacar-extra-filters-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/instacar-extra-filters-bundle/health.svg)](https://phpackages.com/packages/instacar-extra-filters-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[cmsig/seal-symfony-bundle

An integration of CMS-IG SEAL search abstraction into Symfony Framework.

15195.8k5](/packages/cmsig-seal-symfony-bundle)

PHPackages © 2026

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