- What does pacolmg/symfony-filter-bundle do?
- It adds a declarative filtering layer to Symfony applications so you can define filters once and have them applied automatically from incoming request parameters. This keeps controllers and repositories lean and makes filtering behavior predictable across list endpoints and queries.
- How do I install pacolmg/symfony-filter-bundle?
- Install it with Composer using composer require pacolmg/symfony-filter-bundle. Then register the bundle in your Symfony application, for example in config/bundles.php, and configure any filter sets you need. Check the repository README for exact registration and configuration steps.
- Can I use this package in Laravel instead of Symfony?
- No, this is a Symfony bundle that integrates with Symfony's service container and configuration, so it is not a drop-in solution for Laravel. Laravel developers evaluating it should treat it as a pattern reference and use Laravel-native packages or Eloquent query scopes for similar filtering.
- How do I bind a filter to a request parameter?
- You declare a filter definition and map it to the request parameter that should drive it; the bundle then reads that parameter and applies the filter automatically. The exact declaration syntax depends on the bundle's configuration format, so consult the package documentation for examples.
- Does it support filtering Doctrine queries and collections?
- Yes, the bundle is described as applying filters to Doctrine queries and collections or list endpoints. You define filter sets and apply them automatically, which helps keep query logic consistent and maintainable.
- How do I configure different filter sets per route or endpoint?
- The bundle supports configurable filter sets per route or endpoint, typically through Symfony configuration. You define the filter set once and associate it with the relevant controller or route, so each endpoint gets the filters it needs without duplicating logic.
- Which Symfony versions does pacolmg/symfony-filter-bundle support?
- The supported Symfony versions are defined in the package's composer.json and README. Because it relies on Symfony's service container and configuration, it targets Symfony applications that use the standard bundle system. Always check the repository for the current compatibility matrix before installing.
- How should I test filtering behavior in a Symfony app?
- Use Symfony's testing tools, such as KernelTestCase or WebTestCase, to send requests with filter parameters and assert the resulting query or collection output. Unit-test individual filter definitions separately, and add integration tests for each configured filter set per route.
- Is pacolmg/symfony-filter-bundle production-ready?
- It is a lightweight bundle intended for real Symfony applications, but production readiness depends on your risk tolerance and the repository's maintenance activity. Review recent commits, releases, and open issues, pin a specific version in Composer, and test thoroughly in your own app.
- What are alternatives to this bundle for filtering in Symfony or Laravel?
- In Symfony, alternatives include API Platform's built-in filters, Doctrine query extension packages, and custom query builder logic. In Laravel, developers often use packages like Spatie Query Builder or Eloquent query scopes. This bundle is one option when you want declarative, request-driven filters in Symfony.