@@ -20,15 +20,16 @@ $ composer require php-http/curl-client
20
20
21
21
## Usage
22
22
23
- ### Using [ php-http/utils ] ( https://packagist.org/packages/php-http/utils ) :
23
+ ### Using [ php-http/discovery ] ( https://packagist.org/packages/php-http/discovery ) :
24
24
25
25
``` php
26
26
use Http\Client\Curl\Client;
27
- use Http\Client\Utils\MessageFactory\GuzzleMessageFactory ;
28
- use Http\Client\Utils\StreamFactory\GuzzleStreamFactory ;
27
+ use Http\Discovery\MessageFactoryDiscovery ;
28
+ use Http\Discovery\StreamFactoryDiscovery ;
29
29
30
- $messageFactory = new GuzzleMessageFactory();
31
- $client = new Client($messageFactory, new GuzzleStreamFactory());
30
+ $messageFactory = MessageFactoryDiscovery::find();
31
+ $streamFactory = StreamFactoryDiscovery::find();
32
+ $client = new Client($messageFactory, $streamFactory);
32
33
33
34
$request = $messageFactory->createRequest('GET', 'http://example.com/');
34
35
$response = $client->sendRequest($request);
@@ -54,14 +55,14 @@ You can use [cURL options](http://php.net/curl_setopt) to configure Client:
54
55
55
56
``` php
56
57
use Http\Client\Curl\Client;
57
- use Http\Client\Utils\MessageFactory\GuzzleMessageFactory ;
58
- use Http\Client\Utils\StreamFactory\GuzzleStreamFactory ;
58
+ use Http\Discovery\MessageFactoryDiscovery ;
59
+ use Http\Discovery\StreamFactoryDiscovery ;
59
60
60
61
$options = [
61
62
CURLOPT_CONNECTTIMEOUT => 10, // The number of seconds to wait while trying to connect.
62
63
CURLOPT_SSL_VERIFYPEER => false // Stop cURL from verifying the peer's certificate
63
64
];
64
- $client = new Client(new GuzzleMessageFactory (), new GuzzleStreamFactory (), $options);
65
+ $client = new Client(MessageFactoryDiscovery::find (), StreamFactoryDiscovery::find (), $options);
65
66
```
66
67
67
68
These options can not ne used:
0 commit comments