laravel-quantum-slipstream-drive maintained by vusys
Laravel Quantum Slipstream Drive
Fold your Eloquent queries into a slipstream until the database wonders where everybody went.
A scoped Eloquent identity map, process-truth engine, and query-elision planner for Laravel. Add one trait and the same model loaded by a middleware, a controller, a policy, and a view composer is fetched once — every redundant SELECT for the life of the request or job is served from memory instead.
It goes beyond the classic single-key identity map: it rewrites key-set queries so only unknown IDs hit the database, evaluates WHERE predicates against cached attributes, serves where('email', …)->first() lookups from a unique-key index, and tracks whole query regions so a broad ->get() primes narrower follow-ups. Nothing is serialized or shared between processes; when the scope ends, the map is discarded.
📚 Full documentation: vusys.github.io/laravel-quantum-slipstream-drive
Requirements
- PHP 8.3+
- Laravel 11, 12, or 13
Installation
composer require vusys/laravel-quantum-slipstream-drive
Quick start
Add the HasIdentityMap trait to any Eloquent model — that is the entire setup:
use Vusys\QuantumSlipstreamDrive\HasIdentityMap;
final class User extends Model
{
use HasIdentityMap;
}
Now redundant reads within a request or job are elided automatically:
$a = User::find(1);
$b = User::find(1);
$a === $b; // true — the second call issues no SQL
User::find([1, 2, 3, 4]);
// Already in map: 1, 2. Confirmed absent: 3.
// SQL: SELECT * FROM users WHERE id IN (4)
The Getting started guide covers opting out per query, manual flushing, and disabling for a scope.
Documentation
Full docs live at vusys.github.io/laravel-quantum-slipstream-drive. By topic:
| Topic | Page |
|---|---|
| The problem, what it is / is not, when it helps | Home |
| Installing and requirements | Installation |
| Opt-in trait, opt-out, flush, disable | Getting started |
Unique-key lookups, explain(), predicates, relations |
Usage |
| Every config key and env override | Configuration |
| How the engine works internally | Architecture & internals |
explain(), the QueryDecided event, the decision log |
Observability |
| The six test layers and the CI matrix | Testing |
Contributing
See CONTRIBUTING.md for the four quality gates and code conventions, and CHANGELOG.md for release history.
License
MIT. See LICENSE.