Foxws

Laravel Scout · Query Builder · API Filters

Laravel Scout Builder

Build safe Laravel Scout search queries straight from API requests.

composer require foxws/laravel-scout-builder
Get startedSource
Latest release
1.2.0
Requires
PHP ^8.4
Laravel
12.x / 13.x
Licence
MIT
Downloads
2.1K/mo

Introduction

Laravel Scout is Laravel's search package. This package adds a query builder on top of it, so you can turn HTTP request parameters into safe search queries.

It's modeled closely on spatie/laravel-query-builder and uses the same AllowedFilter / AllowedSort style. If you already know that package, this one will feel familiar — it's just built for Scout instead of Eloquent.

With it, API clients can filter, sort, include relationships, and paginate search results, all through query string parameters, without you writing that logic by hand for every endpoint.

Credits — This package is a close adaptation of spatie/laravel-query-builder. All credit for the original architecture, patterns, and API design belongs to Spatie. If this package is useful to you, please consider supporting Spatie.

Let your AI agent do the hard parts. This package ships a Laravel Boost skill, scout-builder-development, that teaches your agent how to install, configure and use Laravel Scout Builder. Install Boost and select the skill when prompted:

composer require laravel/boost --dev
php artisan boost:install

Already using Boost? Run php artisan boost:update --discover to pick up the skill. Then just ask, for example: "Add a /api/posts search endpoint with status and tag filters, sorting and pagination."

Continue to Installation to get started.