Skip to content

php-http/react-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7d2f4c7 · Mar 3, 2016

History

40 Commits
Mar 2, 2016
Mar 2, 2016
Jan 11, 2016
Jan 11, 2016
Jan 11, 2016
Jan 11, 2016
Jan 11, 2016
Jan 11, 2016
Jan 11, 2016
Mar 3, 2016
Nov 23, 2015
Jan 11, 2016
Jan 11, 2016
Jan 12, 2016
Mar 2, 2016
Nov 23, 2015
Jan 12, 2016

Repository files navigation

React adapter for PHP HTTP

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

ReactHTTP adapter.

Install

Via Composer

$ composer require php-http/react-adapter

Features

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.

Usage

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

Testing

First launch the http server:

$ ./vendor/bin/http_test_server > /dev/null 2>&1 &

Then the test suite:

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please contact us at security@php-http.org.

License

The MIT License (MIT). Please see License File for more information.