clue/buzz-react
Async HTTP client for ReactPHP built on Buzz: send concurrent requests, stream responses, and integrate with event-loop apps. Lightweight, promise-based API for non-blocking web calls in long-running CLI/daemon services.
GuzzleHttp\Psr7), ensuring compatibility with existing middleware stacks (e.g., Symfony’s HTTP client, middleware layers).symfony/http-client → buzz-react).php-react/promise).HttpClient, or Swoole’s coroutines, does Buzz-React offer unique advantages?AsyncHttpClient service (e.g., app/Services/BuzzReactClient) using dependency injection.$client = new BuzzReactClient(
new React\Http\Client($loop),
new Psr7Factory()
);
AsyncHttpTask::dispatch($url, $data)->onQueue('async-http');
AsyncHttpTask with handle() using Buzz-React.if ($isAsync) {
return $asyncClient->request($request);
}
return Http::send($request); // Sync fallback
^1.0) to avoid BC breaks.clue/reactphp-buzz and psr/http-message versions align.clue/reactphp-retry) for transient failures.Http::async()). Document:
React\Promise\Timer\TimeoutException for timeouts.$loop in unit tests (e.g., React\EventLoop\LoopInterface).Xdebug + React\Debug.| Scenario | Solution |
|---|---|
| Hanging requests | Implement circuit breakers. |
| Rate limiting | Use React\Http\Message\Stream. |
| Auth token leaks | Avoid global state; pass tokens per request. |
async-http jobs.React\Promise\Timer\TimeoutException).| Failure Type | Impact | Mitigation |
|---|---|---|
| Event loop crash | All async requests fail | Use React\EventLoop\Loop::run() in a separate process. |
| Unhandled exceptions | Silent failures | Wrap promises in ->otherwise() or use React\Promise\rejectForUncaughtExceptions(). |
| Network timeouts | Partial batch failures | Implement exponential backoff. |
| Dependency incompatibility | Worker startup failures | Containerize workers (Docker) with pinned versions. |
| PHP version mismatch | Runtime errors | Use PHP 7.4 LTS or 8.1 with strict versioning. |
new React\Promise\Promise(...).->then()->otherwise().php artisan buzz:list-pending
How can I help you explore Laravel packages today?