@@ -8,6 +8,7 @@ Event-driven, streaming HTTP client for [ReactPHP](https://reactphp.org).
88** Table of Contents**
99
1010* [ Basic usage] ( #basic-usage )
11+ * [ Client] ( #client )
1112 * [ Example] ( #example )
1213* [ Advanced usage] ( #advanced-usage )
1314 * [ Unix domain sockets] ( #unix-domain-sockets )
@@ -17,6 +18,36 @@ Event-driven, streaming HTTP client for [ReactPHP](https://reactphp.org).
1718
1819## Basic usage
1920
21+ ### Client
22+
23+ The ` Client ` is responsible for communicating with HTTP servers, managing the
24+ connection state and sending your HTTP requests.
25+ It also registers everything with the main [ ` EventLoop ` ] ( https://github.com/reactphp/event-loop#usage ) .
26+
27+ ``` php
28+ $loop = React\EventLoop\Factory::create();
29+ $client = new Client($loop);
30+ ```
31+
32+ If you need custom connector settings (DNS resolution, TLS parameters, timeouts,
33+ proxy servers etc.), you can explicitly pass a custom instance of the
34+ [ ` ConnectorInterface ` ] ( https://github.com/reactphp/socket#connectorinterface ) :
35+
36+ ``` php
37+ $connector = new \React\Socket\Connector($loop, array(
38+ 'dns' => '127.0.0.1',
39+ 'tcp' => array(
40+ 'bindto' => '192.168.10.1:0'
41+ ),
42+ 'tls' => array(
43+ 'verify_peer' => false,
44+ 'verify_peer_name' => false
45+ )
46+ ));
47+
48+ $client = new Client($loop, $connector);
49+ ```
50+
2051The ` request(string $method, string $uri, array $headers = array(), string $version = '1.0'): Request `
2152method can be used to prepare new Request objects.
2253
0 commit comments