Download the PHP package legionth/http-client-react without Composer
On this page you can find all versions of the php package legionth/http-client-react. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package http-client-react
legionth/http-client-react
HTTP client written in PHP on top of ReactPHP.
Table of Contents
- Usage
- Request body
- Install
- License
Usage
The client is responsible to send HTTP requests and receive the HTTP response from the server.
This library uses PSR-7 objects to make it easier to handle the HTTP-Messsages.
It could take some time until the response is transferred from the server
to the client.
For this reason the request
-method will return a
ReactPHP promise.
The promise will result in a PSR-7 response object
The body of the response will always be an asynchronous ReactPHP Stream.
The end
-Event will be emmitted when the complete body of the HTTP response
has been transferred to the client.
In the example above it will exit the current script.
Request body
You can add also add a ReactPHP Stream as
the request body to stream data with it.
The body will always be transferred chunked encoded if you use this method,
any header like Content-Length
or other Transfer-Encoding
headers will
be replaced.
This example will transfer every 0.5 seconds a chunked encoded data to the server. The transmission of the body will end after 5 seconds.
Checkout the examples
folder to try it yourself.
Install
This will install the latest supported version:
License
MIT
All versions of http-client-react with dependencies
react/event-loop Version ^1.0.0
react/socket Version ^1.0.0
react/stream Version ^1.0.0
react/promise Version ~1.0|~2.0
evenement/evenement Version ~1.0|~2.0
ringcentral/psr7 Version ^1.2