Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
React Adapter

React Adapter Laravel Package

php-http/react-adapter

ReactPHP adapter for the PHP-HTTP httplug abstraction. It lets you send asynchronous, non-blocking HTTP requests through ReactPHP's event loop using the standard httplug and PSR-7 interfaces, so existing client code keeps working unchanged.

Deep Wiki
Context7

php-http/react-adapter is a ReactPHP-based HTTP adapter for the HTTPlug (PHP-HTTP) abstraction, letting you send PSR-7 requests asynchronously through an event loop. It bridges the synchronous Http\Client\HttpClient interface with ReactPHP's non-blocking I/O, so libraries built on HTTPlug can use an event-driven transport without code changes.

  • Non-blocking HTTP requests powered by ReactPHP
  • Implements HTTPlug HttpClient and HttpAsyncClient interfaces
  • Works with any PSR-7 request/response implementation
  • Integrates cleanly with an existing event loop
  • Drop-in adapter for libraries depending on php-http/client-common
Frequently asked questions about React Adapter
What is php-http/react-adapter and what does it do?
It is an HTTPlug adapter that lets PHP-HTTP send asynchronous PSR-7 HTTP requests through ReactPHP's event loop. It bridges React-based HTTP clients into the PHP-HTTP ecosystem so code can issue non-blocking requests instead of using a blocking client such as Guzzle. It is not a Laravel-specific HTTP abstraction; it is an infrastructure package for applications that already own or can safely manage a ReactPHP loop.
Does php-http/react-adapter work with Laravel?
Composer can install it in a Laravel application, and you can bind its HTTPlug interfaces in Laravel's container, but it is not designed as a drop-in replacement for Illuminate\Http\Client. It only fits Laravel code paths that can safely own a ReactPHP event loop, such as dedicated CLI commands, daemons, or workers. Standard FPM request paths and normal Laravel HTTP calls should stay on Guzzle or Laravel's HTTP client.
How do I install php-http/react-adapter in a Laravel app?
Install it with Composer using the package name php-http/react-adapter, and ensure you also have compatible ReactPHP, HTTPlug, and PSR-7 implementation dependencies pinned. Because it is not Laravel-native, there is no Artisan install command or Laravel service provider to publish. You bind the adapter and its dependencies manually in a service provider or dedicated module, then test the event loop lifecycle outside the normal web request path.
Can I use php-http/react-adapter with Laravel Octane?
Not naturally. Octane workers run on Swoole or RoadRunner, not ReactPHP, so Octane does not provide the React event loop this adapter expects. You should validate the adapter separately if Octane is in use and avoid assuming compatibility just because both are long-running runtimes. For typical Octane request handling, Laravel's HTTP client is the safer choice.
What use cases make sense for this ReactPHP adapter in Laravel?
It makes sense for isolated async workloads such as CLI daemons, queue workers, or internal high-concurrency service calls where non-blocking HTTP is a real benefit. It is a poor fit for ordinary Laravel FPM request/response flows or broad replacement of Illuminate\Http\Client. Encapsulate it behind an application-owned interface and use it only where the team can operate a ReactPHP event loop in production.
How do I configure the ReactPHP event loop and bind the adapter in Laravel?
You need to create and own the ReactPHP event loop in a dedicated command, worker, or service module, then construct the adapter with compatible ReactPHP HTTP client and PSR-7 dependencies. Bind HTTPlug async client interfaces or your own wrapper in Laravel's container only for that module, rather than globally replacing Laravel's HTTP client. Define where the loop starts, runs, and terminates, and keep blocking Laravel code out of the same execution path to avoid deadlocks and timeouts.
Is php-http/react-adapter PSR-18 compatible or only HTTPlug async?
The context describes it as an HTTPlug adapter for ReactPHP's async HTTP client, not as a standard PSR-18 synchronous client. Treat PSR-18 compatibility as unconfirmed unless you verify it against the specific package version and its interfaces. If your code expects PSR-18, wrap or test the adapter carefully rather than assuming it can replace a synchronous PSR-18 client.
What Laravel and PHP versions does php-http/react-adapter support?
The provided context does not list explicit Laravel or PHP version constraints, so you must check the package's Composer requirements and test against your target stack. Pin compatible versions of ReactPHP, HTTPlug, your PSR-7 implementation, and PHP in Composer. Verify the Laravel versions your product actually supports, and include PHP 8.1 through 8.3 where applicable rather than relying on assumptions.
How should I handle timeouts, retries, cancellation, and errors with this adapter?
Async HTTP introduces promise rejection handling, cancellation, connection pooling, event-loop blocking, and observability concerns that are not typical in Laravel's blocking HTTP client. Implement timeouts, retries, idempotency rules, and cancellation at your application-owned wrapper boundary so callers keep consistent semantics. Test error paths and load behavior in the target worker model, not only in unit tests.
Is php-http/react-adapter maintained and safe for production, and what are alternatives?
Adoption signals are low, with 19 stars and a last release in November 2022, so maintenance stagnation and compatibility drift with ReactPHP or PHP versions are real risks. MIT licensing is acceptable, but security patching and upstream responsiveness are uncertain. For normal Laravel HTTP calls, use Illuminate\Http\Client with Guzzle; for async needs, consider maintained PSR-18 clients or queue-based concurrency, and keep a rollback path behind a wrapper.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console