Drop-in replacement for spatie
API-compatible with spatie/laravel-query-builder 7.x, with the same class names, method signatures, exceptions and configuration file. Switching is a namespace change.
The filter[], sort, include and fields[] query parameters are checked against an allow-list and applied to an Eloquent query.
GET /users?fields[users]=name&fields[posts]=title&include=posts
QueryBuilder::for(User::class) ->allowedFields('name', 'posts.title') ->allowedIncludes('posts') ->get();
select "users"."name", "users"."id" from "users" select "posts"."title", "posts"."user_id" from "posts" where "posts"."user_id" in (1, 2, 3)
composer require myprogs/query-builderRequires PHP 8.3 or newer and Laravel 12 or 13. The service provider is auto-discovered. Continue with the documentation.