myerscode/laravel-query-strategies
myerscode/laravel-query-strategies provides reusable, composable query strategies for Laravel Eloquent models, helping you encapsulate filtering, sorting, and search logic to keep controllers clean and queries testable.
withCount/withSum), soft-delete visibility via TrashedClause, range filters via BetweenClause, null checks, and model scopes via ScopeClause.paginate, and the cached defaultMethods map support page-load performance goals and reduce N+1 and over-fetching risk in list views.Consider it when:
Parameter object is now readonly.Look elsewhere when:
Executives: This is an open-source building block that lets us ship flexible, self-serve filtering and sorting on our internal tools and customer-facing lists with substantially less engineering effort and a smaller bug surface. It makes each new admin or reporting screen cheaper than the last and is safer by default because filters are allowlisted. The cost is a dependency and an upgrade cadence, not a licence.
Engineering: 13.0.0 is a maturity release, not a point patch. It adds Laravel 13 / Testbench 11 support; a declarative filter/clause/parameter model (ScopeClause, IsNull/IsNotNull, TrashedClause, BetweenClause, callback/inline filters); default model strategy with auto-pickup and default filters; aggregate relationship includes; nested relationship sorting; and opt-in strict mode with eager-load validation. Performance work (cached defaultMethods map, direct clause instantiation, removal of collect() in hot paths, redundant-limit fix) plus Rector modernization, readonly Parameter, and Larastan level 8 signal it is production-lean. Recommendation: timebox a spike on one internal list endpoint to validate DX, the strict-mode allowlist ergonomics, and the Laravel 13 upgrade path before standardising across resources.
How can I help you explore Laravel packages today?