Skip to content

Commit afadf46

Browse files
committed
Merge HTTPlug intro and re-group TOC
1 parent 305abcc commit afadf46

File tree

3 files changed

+36
-42
lines changed

3 files changed

+36
-42
lines changed

httplug.rst

Lines changed: 0 additions & 35 deletions
This file was deleted.

httplug/introduction.rst

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
1-
Introduction to HTTPlug
2-
=======================
1+
HTTPlug: HTTP client abstraction
2+
================================
3+
4+
HTTPlug is an abstraction for HTTP clients. There are two main use cases:
5+
6+
1. Usage in a project/application
7+
2. Usage in a reusable package
8+
9+
The client interfaces
10+
---------------------
11+
12+
HTTPlug defines two HTTP client interfaces that we kept as simple as possible:
13+
14+
* ``HttpClient`` defines a ``sendRequest`` method that sends a PSR-7
15+
``RequestInterface`` and either returns a PSR-7 ``ResponseInterface`` or
16+
throws an exception that implements ``Http\Client\Exception``.
17+
18+
* ``HttpAsyncClient`` defines a ``sendAsyncRequest`` method that sends a request
19+
asynchronously and always returns a ``Http\Client\Promise``.
20+
21+
Implementations
22+
---------------
23+
24+
PHP-HTTP offers two types of clients that implement the above interfaces:
25+
26+
1. standalone clients that directly implement the interfaces.
27+
- Examples: :doc:`/clients/curl-client` and :doc:`/clients/socket-client`.
28+
29+
2. adapters act as a bridge between the HTTPlug interfaces and HTTP client
30+
libraries that do not (yet) implement these interfaces. Examples:
31+
a :doc:`/clients/guzzle6-adapter` and a :doc:`/clients/react-adapter`.
332

433
HTTPlug implementations
534
-----------------------

index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ for discussion around a future HTTP client PSR.
6464

6565
.. toctree::
6666
:hidden:
67-
:maxdepth: 3
6867

6968
PHP-HTTP <self>
7069

7170
.. toctree::
7271
:hidden:
72+
:caption: HTTPlug
7373

74-
HTTPlug <httplug>
75-
76-
.. toctree::
77-
:hidden:
74+
Introduction <httplug/introduction>
75+
Tutorial <httplug/tutorial>
76+
Migrating <httplug/migrating>
77+
Virtual package <httplug/virtual-package>
7878

7979
clients
8080
plugins/index

0 commit comments

Comments
 (0)