Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Laravel Scout SQLite FTS5 Driver

Full-text search for your Eloquent models, powered by SQLite’s own FTS5 engine. A Laravel Scout driver that keeps the search index right next to your data.

No daemon, no API key, no second datastore to keep in sync.

Customer::search('kowalsky')->paginate(20);

That query finds Jan Kowalski despite the typo, because search runs as a cascade of progressively fuzzier passes and stops at the first one that matches. Results come back ranked by BM25, ordered and paginated in SQL.

Install

composer require mtk3d/scout-sqlite-fts5
SCOUT_DRIVER=sqlite-fts5
php artisan scout:fts5-create
php artisan scout:import "App\Models\Customer"

There is no migration to publish. Index tables are derived from the models that use Laravel\Scout\Searchable, and scout:fts5-rebuild recreates them from scratch whenever you need.

Where to go next

How it works is the one to read if you want to know what you are running: what the index looks like, what each of the four passes does, why the substring pass has a threshold, and how results are ranked.

Filtering and ordering covers where(), whereIn(), sorting, what pagination guarantees, soft deletes, and how models with string keys differ.

Configuration is the reference: every option, what it costs, whether it needs a rebuild, and how to swap the normalizer or any other service.

Recipes has the patterns — a search box, telling a user the match was fuzzy, indexing relations, multi-tenancy, bulk imports, NativePHP, and testing search in your own application.

Troubleshooting lists every error the package throws with what to do about it, plus the behaviour that looks like a bug and is not.

Status

This is version 0, the first implementation. The search was built for a NativePHP application and shaped by what that application needed, which is the case it is known to serve well — not evidence that it is the right shape for every application.

Development continues, and the way documents are written and stored is the part most likely to change — but not inside version 0. Every 0.x release keeps the index format the one before it had, so upgrading within 0 is an ordinary composer update. A change of format waits for version 1, which may index different things, store them differently, or lay the tables out another way entirely. When it comes, adopting it is a scout:fts5-rebuild rather than a migration you have to write, because the index is derived from your models. The changelog records what changed and when.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13, with Scout 11
  • SQLite compiled with FTS5 — the default in every mainstream PHP build since 3.9
php -r 'echo (new PDO("sqlite::memory:"))->exec("CREATE VIRTUAL TABLE t USING fts5(c)") === false ? "missing" : "ok";'

The package is MIT licensed and lives on GitHub.