studiomado/query-bundle
Query Bundle is a Laravel package for building reusable, composable Eloquent queries. It helps move complex filtering, sorting, and data retrieval logic into dedicated query classes, keeping controllers and models cleaner and making database queries easier to maintain and test.
?filter[status]=active&sort=-created_at&page=2 into a safe Eloquent query. This package is a candidate to replace the hand-rolled if ($request->has(...)) blocks that accumulate per controller — a decision worth making once and applying consistently rather than re-litigating per feature.Consider it when all of the following hold:
app/.Look elsewhere when:
laravel-query-builder for the same problem: same conceptual model (allowed filters, sorts, includes, pagination), actively maintained, large install base, documented security posture. It is the default answer for most teams.Decision rule: treat this as a reference implementation to read, not a dependency to install, unless a timeboxed spike shows it covers your Laravel version and your filter grammar out of the box.
For executives (one paragraph): We have a recurring, undifferentiated engineering cost — every list screen and API collection endpoint re-implements filtering, sorting, and pagination. A small open-source Laravel package, studiomado/query-bundle, offers a standard way to declare those behaviors once. The strategic value is modest and the risk is low but nonzero: it is MIT-licensed and tiny enough to audit and own outright, but it has negligible community traction (13 stars, no downstream dependents, last release in 2022), so we should not treat it as a supported vendor dependency. Recommendation: do not adopt as a dependency; use it as a design reference and, if we want the pattern, either adopt Spatie's maintained equivalent or absorb ~100 lines into our own codebase. Cost of the evaluation is a one-day spike; the payoff is a consistent API convention across every list endpoint we ship.
For engineering (summary): Narrow, single-purpose abstraction over Eloquent query construction from request parameters — filters, sorts, includes, pagination — expressed as reusable bundle classes. Strengths: small, readable, MIT, no lock-in; the convention it enforces is more valuable than the code. Weaknesses: unmaintained since Oct 2022, no dependents, likely Laravel 9-era, no security process, no community to escalate to. Adopt only behind an allow-list you control (explicit filterable/sortable/includeable columns, mandatory tenant scoping, no raw column names from the client), and either fork it into packages/ or vendor the pattern. Benchmark it against spatie/laravel-query-builder on the same endpoint before committing; if the API surface is close, take the maintained one. Switching cost is low either way — the abstraction is thin, so a later swap is a contained refactor rather than an architectural change.
How can I help you explore Laravel packages today?