clue/connection-manager-extra
Extra connector decorators for ReactPHP Socket. Wrap ConnectorInterface to add retries, timeouts, delays, rejection rules, swapping, consecutive/random selection, concurrency limits and selective routing—without changing your async connect() code.
Socket component, providing non-blocking, promise-based connection management—ideal for Laravel applications requiring high concurrency (e.g., real-time APIs, WebSockets, or async task queues).Repeat, Timeout, Delay, etc.) wraps a ConnectorInterface, enabling modular, composable connection logic without tight coupling. This aligns with Laravel’s service container and dependency injection principles.HttpClient (via reactphp/http-client) for async requests.beberlei/ratchet or react/websocket for async WebSocket servers/clients.react/event-loop) for async task pipelines.react/socket, react/promise) as a dependency, which may introduce minor friction if the Laravel app isn’t already async-first.Promise support (via Illuminate\Support\Facades\Promise) is incompatible with ReactPHP’s PromiseInterface. A bridge (e.g., react/promise + Laravel’s Promise) would be needed.StreamedResponse or Storage (e.g., S3 streams) is plausible but requires manual stream handling.Selective or Consecutive could mirror Laravel’s HTTP middleware, but would need custom middleware wrappers for HTTP routes.ConnectionException) differ from Laravel’s HttpException/Throwable. A custom exception mapper may be needed for consistency.ConnectionManagerRepeat for failed database connections in a queue worker?"Promise facade or ReactPHP’s promises directly?ConnectionTimeout) map to Laravel’s error handling (e.g., App\Exceptions\Handler)?ConnectionManagerRepeat vs. Laravel’s retry() helper)?React\Promise\Test\TestLoop.)| Laravel Component | Integration Strategy | Tools/Libraries |
|---|---|---|
| HTTP Client | Wrap HttpClient with ConnectionManagerTimeout/Repeat for async retries. |
reactphp/http-client, Guzzle bridge |
| Queues | Use decorators in queue workers (e.g., ConnectionManagerRepeat for DB retries). |
Laravel Queues + react/event-loop |
| WebSockets | Replace sync WebSocket clients with ConnectionManagerDelay/Consecutive for failover. |
beberlei/ratchet, react/websocket |
| Event Loop | Run ReactPHP’s loop alongside Laravel’s Swoole/Pcntl (if used) or as a separate process. | react/event-loop, swoole |
| Middleware | Create custom middleware to apply ConnectionManagerSelective to HTTP routes. |
Laravel Middleware + react/socket |
| Artisan Commands | Use decorators in long-running commands (e.g., ConnectionManagerTimeout for APIs). |
Laravel Console + React\AsyncProcess |
clue/connection-manager-extra and react/socket to composer.json.ConnectionManagerRepeat) in a queue job or HTTP client.ConnectionManagerReject).React\Promise to Illuminate\Support\Promise).$httpClient = new HttpClient();
$retryConnector = new ConnectionManagerRepeat($httpClient->getConnector(), 3);
$httpClient->setConnector($retryConnector);
retry() helper) with async decorators in critical paths.ConnectionManagerTimeout failures).ConnectionManagerRepeat.ConnectionManagerTimeout to external HTTP calls.Timeout/Repeat for retries.Selective for network policies.Concurrent/Consecutive for failover.React\Debug\Debugger for async backtraces.monolog with async handlers).try-catch to log failures:
$connector->connect('example.com')->then(
fn($stream) => $stream->write('GET /'),
fn($e) => Log::error('Connection failed', ['error' => $e->getMessage()])
);
events + react/async listeners.clue/prometheus).How can I help you explore Laravel packages today?