@@ -12,12 +12,16 @@ Client Interfaces
1212
1313HTTPlug defines two HTTP client interfaces that we kept as simple as possible:
1414
15- * ``HttpClient `` defines a ``sendRequest `` method that sends a PSR-7
16- ``RequestInterface `` and either returns a PSR-7 ``ResponseInterface `` or
17- throws an exception that implements ``Http\Client\Exception ``.
15+ * PSR-18 defines the ``ClientInterface `` with a ``sendRequest `` method that
16+ accepts a PSR-7 ``RequestInterface `` and either returns a PSR-7
17+ ``ResponseInterface `` or throws an exception that implements
18+ ``Psr\Http\Client\ClientExceptionInterface ``.
1819
19- * ``HttpAsyncClient `` defines a ``sendAsyncRequest `` method that sends a request
20- asynchronously and always returns a ``Http\Client\Promise ``.
20+ HTTPlug has the compatible interface ``HttpClient `` which now extends the
21+ PSR-18 interface to allow migrating to PSR-18.
22+
23+ * ``HttpAsyncClient `` defines a ``sendAsyncRequest `` method that sends a PSR-7
24+ request asynchronously and always returns a ``Http\Client\Promise ``.
2125 See :doc: `../components/promise ` for more information.
2226
2327Implementations
@@ -29,16 +33,22 @@ PHP-HTTP offers two types of clients that implement the above interfaces:
2933
3034 Examples: :doc: `/clients/curl-client ` and :doc: `/clients/socket-client `.
3135
32- 2. Adapters that wrap existing HTTP client , such as Guzzle. These adapters act
36+ 2. Adapters that wrap existing HTTP clients , such as Guzzle. These adapters act
3337 as a bridge between the HTTPlug interfaces and the clients that do not (yet)
3438 implement these interfaces.
3539
36- Examples: :doc: `/clients/guzzle6-adapter ` and :doc: `/clients/react-adapter `.
40+ More and more clients implement PSR-18 directly. If that is all you need, we
41+ recommend not using HTTPlug as it would only add overhead. However, as there
42+ is no PSR for asynchronous requests yet, you can use the adapters to do such
43+ requests without binding yourself to a specific implementation.
44+
45+ Examples: :doc: `/clients/guzzle7-adapter ` and :doc: `/clients/react-adapter `.
3746
3847.. note ::
3948
40- Ideally, all HTTP client libraries out there will implement the HTTPlug
41- interfaces. At that point, our adapters will no longer be necessary.
49+ Ideally, there will be a PSR for asynchronous requests and all HTTP client
50+ libraries out there will implement PSR-18 and the not yet existing PSR. At
51+ that point, our adapters will no longer be necessary.
4252
4353Usage
4454-----
0 commit comments