- What is l3aro/pipeline-query-collection used for in Laravel?
- It is a lightweight Laravel package that lets you build Eloquent queries and collections as a sequence of composable pipeline stages. Each stage is a small, reusable class that applies a query constraint, so filtering, sorting, and similar read-side logic stays out of controllers and models. It targets repeated, user-driven query surfaces such as admin tables, reporting screens, and API index endpoints.
- How do I install l3aro/pipeline-query-collection?
- Install it with Composer: composer require l3aro/pipeline-query-collection. There are no migrations to publish, no data backfill, and no changes to your data model, so adoption is limited to defining pipeline classes and wiring them into your read path. You can trial it on a single endpoint behind a feature flag and revert by removing the dependency.
- Does l3aro/pipeline-query-collection support Laravel 13?
- Version 1.6.0 added Laravel 13.x compatibility, lifting the previous cap at Laravel 12.x. That release was a minor, compatibility-only bump from 1.5.0 with no indicated breaking API changes. The Laravel 13 support arrived through an automated laravel-shift pull request, so confirm behavioural coverage on 13.x against your own test suite rather than assuming full CI coverage.
- How does it compare to spatie/laravel-query-builder?
- Both occupy the same niche: turning request-driven filters into Eloquent query constraints on the read path. spatie/laravel-query-builder has far broader adoption, more public production references, and more community answers, whereas pipeline-query-collection is a niche, single-maintainer package. Choose it when you want explicit pipeline stages you compose yourself; choose the more popular option when ecosystem support and documentation depth matter more.
- Will it change my database schema or require migrations?
- No. The package has no infrastructure footprint: no migrations, no data backfill, and no external services. It only affects how query constraints are assembled before they reach Eloquent. That means it does not alter your deployment topology or your data model.
- Can I reuse the same filter classes across multiple endpoints?
- Yes, that is the core value: each pipeline stage is a standalone class you can chain into different pipelines. Shared filters such as date ranges or status constraints can be composed into several admin tables or API index endpoints without duplication. If you need to swap the package later, wrap it behind an internal interface so application code depends on your own contract rather than the vendor's.
- What are the main risks of using l3aro/pipeline-query-collection in production?
- The dominant risk is bus factor: it is a single-maintainer community package, so abandonment would leave you owning a fork. Adoption risk is medium because the package is niche, meaning fewer public references and more debugging from source. There is also semantic drift risk if its pipeline ordering and short-circuit behaviour diverge from the filter conventions your engineers already expect.
- How do I test a pipeline query in Laravel?
- Because each stage is a discrete class, you can unit test filters in isolation and assert the SQL or results produced by a full pipeline. A practical adoption step is to implement one existing index endpoint in a branch and diff the generated SQL against your current implementation for a representative set of query strings. That comparison catches semantic drift before it reaches production.
- Does it work with FormRequests and API Resources?
- Yes. It is a read-side convenience layer that sits between validation and serialisation, so it composes cleanly with FormRequests for input validation and API Resources for output. It does not handle writes, transactions, or cross-service queries. It fits a conventional Laravel monolith or modular monolith built on Eloquent.
- When is it not worth adopting l3aro/pipeline-query-collection?
- The abstraction cost only amortises when you have repeated, user-driven filtering or sorting surfaces, roughly three or more, such as admin tables, reporting screens, and API index endpoints. With only one or two such surfaces, inline when() chains may be simpler and easier for the team to read. It also adds little value if your query logic rarely changes.