Skip to content

Commit

Permalink
Merge pull request #244 from php-http/client-interfaces
Browse files Browse the repository at this point in the history
adjust to final clients
  • Loading branch information
dbu committed Dec 25, 2018
2 parents f37f0d7 + 8cb8f17 commit 82bea5a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion components/client-common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ To be able to do that, it also wraps a message factory::
$bar = $client->get('http://example.com/bar', ['accept-encoding' => 'application/json']);
$post = $client->post('http://example.com/update', [], 'My post body');

..versionadded:: 2.0
``HttpMethodsClient`` is final since version 2.0. You can typehint the
``HttpMethodsClientInterface`` to allow mocking the client in unit tests.

BatchClient
-----------

Expand All @@ -48,6 +52,10 @@ their responses as a ``BatchResult``::

$batchResult = $client->sendRequests($requests);

..versionadded:: 2.0
``BatchClient`` is final since version 2.0. You can typehint the
``BatchClientInterface`` to allow mocking the client in unit tests.

The ``BatchResult`` itself is an object that contains responses for all requests sent.
It provides methods that give appropriate information based on a given request::

Expand Down Expand Up @@ -123,7 +131,7 @@ To enable the behavior, wrap the clients with the ``HttpClientPoolItem`` class y
// Never reactivate the client (default)
$httpClientPool->addHttpClient(new HttpClientPoolItem($httpClient, null));

``HttpClientPool`` is abstract. There are three concrete implementations with specific strategies on how to choose clients:
``HttpClientPool`` is an interface. There are three concrete implementations with specific strategies on how to choose clients:

LeastUsedClientPool
*******************
Expand Down Expand Up @@ -228,3 +236,7 @@ and also to download an image from a static host::
it's easier to use the ``RequestConditionalPlugin`` and the ``PluginClient``,
but in that case the routing logic is integrated into the linear request flow
which might make debugging harder.

..versionadded:: 2.0
``HttpClientRouter`` is final since version 2.0. You can typehint the
``HttpClientRouterInterface`` to allow mocking the client in unit tests.
4 changes: 2 additions & 2 deletions integrations/symfony-bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Plugins
```````

Clients can have plugins that act on the request before it is sent out and/or
on the response before it is returned to the caller. Generic plugins from
on the response before it is returned to the caller. Generic plugins from
``php-http/client-common`` (e.g. retry or redirect) can be configured globally.
You can tell the client which of those plugins to use, as well as specify the
service names of custom plugins that you want to use.
Expand Down Expand Up @@ -322,7 +322,7 @@ Special HTTP Clients
````````````````````

If you want to use the ``FlexibleHttpClient`` or ``HttpMethodsClient`` from the
``php-http/message`` package you may specify that on the client configuration.
``php-http/client-common`` package, you may specify that on the client configuration.

.. code-block:: yaml
Expand Down

0 comments on commit 82bea5a

Please sign in to comment.