ghostcompiler/laravel-querybuilder
API-ready Eloquent query builder for Laravel with strict allow-lists for filters, sorts, includes, and sparse fields. Supports nested relation filters/sorting, custom filters, tenant scoping, safe public query interfaces, and pagination helpers for clean API responses.
Adopt When:
Look Elsewhere If:
spatie/laravel-searchable.beberlei/assert or custom solutions."This package lets us build secure, scalable APIs faster by enforcing strict query rules—blocking malicious or invalid requests before they hit our database. It’s like a ‘firewall for API queries,’ reducing security risks while standardizing how our teams build APIs. For example, we can roll out a new admin dashboard with complex filtering in weeks, not months, while ensuring only approved fields/sorts are exposed. The MIT license and active maintenance (last release: June 2026) make it a low-risk bet."
*"Problem: Our APIs have inconsistent query handling—some use raw where() clauses, others rely on ad-hoc request parsing, and security gaps exist (e.g., arbitrary field selection). Solution: This package gives us:
?sort=password fails fast).spatie/laravel-query-builder (but those lack strict validation)."*Key Selling Point: "It’s the difference between ‘Does this query work?’ and ‘Is this query safe and performant?’—automatically."
How can I help you explore Laravel packages today?