Download the PHP package vuthaihoc/scout-crdb-driver without Composer
On this page you can find all versions of the php package vuthaihoc/scout-crdb-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package scout-crdb-driver
vuthaihoc/scout-crdb-driver
A Laravel Scout engine for CockroachDB with fine-grained, per-column index strategy control via PHP Attributes.
Features
- ✅ Full-text search — uses
@@ plainto_tsquery()with CockroachDB's Inverted Full-text Index - ✅ Trigram substring — uses
ILIKE '%keyword%'with GIN Trigram Index - ✅ Fuzzy matching — uses
word_similarity() >= thresholdfor typo-tolerant search - ✅ Prefix search — uses
ILIKE 'keyword%'with B-Tree Index - ✅ Exact match — uses
col = ?with B-Tree / GIN Index - ✅ Relevance ordering — combines
ts_rank()andword_similarity()automatically - ✅ Engine-agnostic
searchInFields()macro — scope search fields without touching Controller code when switching drivers
Requirements
- PHP 8.3+
- Laravel 11 / 12 / 13
- Laravel Scout ≥ 10
- CockroachDB with
pg_trgmextension (for Trigram & Fuzzy features)
Installation
Publish the config (optional):
Set the Scout driver in .env:
Database Setup
Enable the trigram extension and create appropriate indexes in your migrations:
Model Configuration
Use PHP Attributes on toSearchableArray() to declare the search strategy per column:
Search Strategy Summary
| Attribute | SQL Generated | Index Required |
|---|---|---|
SearchUsingFullText |
@@ plainto_tsquery(?) |
GIN Full-text Inverted Index |
SearchUsingFuzzy |
word_similarity(?, col) >= N |
GIN Trigram (gin_trgm_ops) |
SearchUsingTrigram |
col ILIKE '%keyword%' |
GIN Trigram (gin_trgm_ops) |
SearchUsingPrefix (Scout) |
col ILIKE 'keyword%' |
B-Tree |
SearchUsingExact |
col = ? |
B-Tree / GIN |
| (default) | col = ? |
B-Tree |
Usage
Basic search
Field-scoped search (engine-agnostic)
This macro works with any engine. If you switch from CRDB to Meilisearch, your Controller code stays unchanged — the engine handles the translation.
Combining with other Scout features
Configuration
Full-text Options
The SearchUsingFullText attribute (from Laravel Scout) supports an options array:
License
MIT
All versions of scout-crdb-driver with dependencies
laravel/framework Version ^11.0|^12.0|^13.0
laravel/scout Version ^10.0|^11.0