dnwk/doctrine-readonly-middleware
ReadonlyMiddleware::enable()) may conflict with dynamic routing needs (e.g., API endpoints requiring mixed read/write access).app/Http/Kernel.php.Connection::setReadOnly(true)) suffice? Or Laravel’s database connections config?app/Http/Kernel.php) after auth but before route-specific middleware.protected $middleware = [
// ...
\DnwK98\DoctrineReadonlyMiddleware\ReadonlyMiddleware::class,
];
ReadonlyMiddleware::enable() and instead:
ReadonlyMiddleware::enable() in a feature flag for gradual adoption.ReadOnlyConnectionException and retry with write connection).composer.json to avoid runtime conflicts.^10.0).config/database.php to define read-only connection (if not using replicas).'read_only' => [
'driver' => 'mysql',
'url' => env('DATABASE_READONLY_URL'),
'read_only' => true,
],
ReadonlyMiddleware::enable() after Doctrine’s BootstrapEvents (if using events).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package fails to switch connections | App crashes or silent write failures | Implement retry logic with write fallback |
| Read replica lag | Stale data served | Add TTL/cache layer or sync checks |
| Doctrine version incompatibility | Runtime errors | Pin exact Doctrine version |
| Mixed read/write routes | Inconsistent behavior | Use route-specific middleware instead |
EntityManager::createQuery() vs. Eloquent).How can I help you explore Laravel packages today?