clue/reactphp-sqlite
Async SQLite client for ReactPHP: run non-blocking queries against SQLite databases using promises and the event loop. Ideal for CLI daemons and long-running apps needing lightweight SQL storage without blocking I/O.
spatie/react or custom event loops) or long-running processes (e.g., queues, CLI workers, or real-time services). It avoids blocking I/O, which is critical for maintaining responsiveness in async workflows.react/pdo or react/mysql instead).spatie/react for seamless integration.Laravel\Promises) but requires refactoring synchronous SQLite calls (e.g., DB::select()) to async patterns.pdo_sqlite).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Async Complexity | High | Requires rewriting synchronous SQLite logic to promises/streams. Use spatie/react for scaffolding. |
| Laravel Ecosystem Gap | Medium | No native Laravel support; must bridge ReactPHP with Eloquent/Query Builder. |
| Error Handling | Medium | Async errors (e.g., SQLite locks) may bypass Laravel’s exception handlers. |
| Testing | Medium | Async tests require ReactPHP’s test utilities (e.g., React\Test\Loop). |
| Performance Overhead | Low | Minimal overhead for I/O-bound tasks; CPU-bound queries remain blocking. |
DB::transaction)?laravel-horizon workers).| Component | Integration Strategy |
|---|---|
| Eloquent | Create async repositories wrapping clue/reactphp-sqlite for query execution. |
| Queues | Use async SQLite for job payloads (e.g., storing intermediate results). |
| Artisan Commands | Replace DB:: calls with async SQLite for CLI tools. |
| Events | Use SQLite streams to reactively emit Laravel events (e.g., database.changed). |
| Testing | Mock ReactPHP’s event loop in PHPUnit (e.g., React\Test\Loop). |
PDO::query() with clue/reactphp-sqlite via a wrapper class.// Before (sync)
$results = DB::select('SELECT * FROM users');
// After (async)
$loop = React\EventLoop\Factory::create();
$sqlite = new \Clue\React\Sqlite\Connection($loop, 'path/to/db.sqlite');
$promise = $sqlite->query('SELECT * FROM users')->then(
function ($results) { return $results; }
);
$loop->run();
clue/reactphp-sqlite.// config/database.php
'connections' => [
'sqlite_async' => [
'driver' => 'react_sqlite',
'database' => database_path('async.db'),
'options' => [],
],
];
react/promise, react/dns, etc.DB:: facade directly; requires wrappers.filesystem disk).spatie/react or set up ReactPHP manually.DB:: calls in CLI/queues with async equivalents.React\Test\Loop.try/catch won’t catch all failures).await promises").How can I help you explore Laravel packages today?