ReactHTTP adapter.
Via Composer
$ composer require php-http/react-adapter
This lib adapt ReactPHP behaviour to use the PSR7 interfaces.
Also sync
and async
requests are possible without more code than a function call.
For a deeper async
comprehension, you must check how ReactPHP engine work.
The Client
class need a message factory in order to work:
$client = new Http\Adapter\React\Client($messageFactory);
For more control, it can also be configured with a specific React\EventLoop\LoopInterface
and / or a specific React\HttpClient\Client
:
$loop = Http\Adapter\React\ReactFactory::buildEventLoop();
$client = new Http\Adapter\React\Client($messageFactory, $loop);
//or
$reactClient = Http\Adapter\React\ReactFactory::buildHttpClient($loop);
$client = new Http\Adapter\React\Client(
$messageFactory,
$loop,
$reactClient
);
If you don't want to use the Http\Adapter\React\ReactFactory
to build instances you must rely on React documentation on Github: https://github.com/reactphp/http-client#example
First launch the http server:
$ ./vendor/bin/http_test_server > /dev/null 2>&1 &
Then the test suite:
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please contact us at [email protected].
The MIT License (MIT). Please see License File for more information.