Skip to content

Commit 2bdf91c

Browse files
committed
improve curl client doc
1 parent da4b53a commit 2bdf91c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

clients/curl-client.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,24 @@ To install the cURL client, run:
1212
1313
$ composer require php-http/curl-client
1414
15-
Usage
16-
-----
17-
18-
The cURL client needs a :ref:`message <message-factory>` and a :ref:`stream <stream-factory>`
19-
factory in order to to work::
15+
.. include:: includes/install-message-factory.inc
2016

21-
use Http\Client\Curl\Client;
17+
.. include:: includes/install-discovery.inc
2218

23-
$client = new Client($messageFactory, $streamFactory);
19+
Usage
20+
-----
2421

25-
Using `php-http/message <https://packagist.org/packages/php-http/message>`_::
22+
The cURL client needs a :ref:`message factory <message-factory>` and a
23+
:ref:`stream factory <stream-factory>` in order to to work. You can either specify the factory
24+
explicitly::
2625

2726
use Http\Client\Curl\Client;
2827
use Http\Message\MessageFactory\DiactorosMessageFactory;
2928
use Http\Message\StreamFactory\DiactorosStreamFactory;
3029

3130
$client = new Client(new DiactorosMessageFactory(), new DiactorosStreamFactory());
3231

33-
Using `php-http/discovery <https://packagist.org/packages/php-http/discovery>`_::
32+
Or you can use :doc:`../discovery`::
3433

3534
use Http\Client\Curl\Client;
3635
use Http\Discovery\MessageFactoryDiscovery;
@@ -53,7 +52,8 @@ You can use `cURL options <http://php.net/curl_setopt>`_ to configure Client::
5352
];
5453
$client = new Client(MessageFactoryDiscovery::find(), StreamFactoryDiscovery::find(), $options);
5554

56-
These options cannot be used (will be overwritten by Client):
55+
The following options can not be changed in the set up. Most of them are to be provided with the
56+
request instead:
5757

5858
* CURLOPT_CUSTOMREQUEST
5959
* CURLOPT_FOLLOWLOCATION

discovery.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Discovery
33

44
The discovery service is a set of static classes which allows to find and use installed resources.
55
This is useful in libraries that want to offer zero-configuration services and rely only on the virtual packages.
6+
Consumers of such a library need to make sure they install one of the implementations.
67

78
Currently available discovery services:
89

@@ -15,13 +16,12 @@ The principle is always the same: you call the static ``find`` method on the dis
1516
implementation was specified. The discovery service will try to locate a suitable implementation.
1617
If no implementation is found, an ``Http\Discovery\NotFoundException`` is thrown.
1718

18-
1919
Installation
2020
------------
2121

2222
.. code-block:: bash
2323
24-
$ composer require php-http/discovery
24+
$ composer require php-http/discovery
2525
2626
HTTP Client Discovery
2727
---------------------

0 commit comments

Comments
 (0)