|
1 |
| -# PHP-HTTP and HTTPlug |
| 1 | +# PHP-HTTP: standardized HTTP interaction for PHP |
2 | 2 |
|
3 |
| -**This is the documentation for the HTTPlug client abstraction and the other PHP-HTTP components.** |
| 3 | +PHP-HTTP is the next step in standardizing HTTP interaction for PHP packages. |
| 4 | +It builds on top of [PSR-7](http://www.php-fig.org/psr/psr-7/), which defines |
| 5 | +interfaces for HTTP requests and responses. PSR-7 does not describe, however, |
| 6 | +the way you should create requests or send them. PHP-HTTP aims to fill that gap |
| 7 | +by offering an HTTP client interface: HTTPlug. |
4 | 8 |
|
| 9 | +PHP-HTTP has three goals: |
5 | 10 |
|
6 |
| -In the past few years HTTP related actions got much more attention. We took a long way from `file_get_contents` to |
7 |
| -[PSR-7](http://www.php-fig.org/psr/psr-7/). We still felt that something was missing: and PHP HTTP was born. |
| 11 | +1. Encourage package developers to depend on the simple HTTPlug interface |
| 12 | + instead of concrete HTTP clients. |
8 | 13 |
|
9 |
| -We aim to provide good quality, HTTP related packages to the PHP community. Our main product is |
10 |
| -[HTTPlug](http://httplug.io), but we also have other smaller packages to make using HTTP more convenient. |
| 14 | +2. Provide good quality HTTP-related packages to the PHP community. |
11 | 15 |
|
| 16 | +3. Over time, make HTTPlug a PSR so that clients will directly implement the |
| 17 | + HTTPlug interface and our adapters are no longer needed. |
12 | 18 |
|
13 | 19 | ## HTTPlug
|
14 | 20 |
|
15 |
| -[PSR-7](http://www.php-fig.org/psr/psr-7/) defines interfaces for HTTP requests and responses. |
16 |
| -However, it does not define how to create a request or how to send a request. |
17 | 21 | HTTPlug abstracts from HTTP clients written in PHP, offering a simple interface.
|
18 |
| -It also provides an implementation-independent plugin system to build pipelines regardless of the |
19 |
| -HTTP client implementation used. |
| 22 | +It also provides an implementation-independent plugin system to build pipelines |
| 23 | +regardless of the HTTP client implementation used. |
20 | 24 |
|
21 | 25 | HTTPlug allows you to write reusable libraries and applications that need
|
22 | 26 | an HTTP client without binding to a specific implementation.
|
23 | 27 | When all packages used in an application only specify HTTPlug,
|
24 |
| -the application developers can chose the client that fits best for their |
25 |
| -project and use the same client with all packages. |
| 28 | +the application developers can choose the client that best fits their project |
| 29 | +and use the same client with all packages. |
26 | 30 |
|
27 | 31 | There are clients implementing one of the HTTPlug interfaces directly,
|
28 |
| -and adapter packages that implement the interface and forward the calls to HTTP clients not implementing the interface. |
| 32 | +and adapter packages that implement the interface and forward the calls to HTTP |
| 33 | +clients not implementing the interface. |
29 | 34 |
|
| 35 | +Get started by reading our [tutorial](httplug/tutorial.md). |
30 | 36 |
|
31 |
| -Read our [tutorial](httplug/tutorial.md). |
| 37 | +## Packages |
32 | 38 |
|
| 39 | +PHP-HTTP offers several packages: |
33 | 40 |
|
34 |
| -# PHP-HTTP Components |
| 41 | +| Type | Description | Namespace | |
| 42 | +| --------------- | ----------------------------------------------------------- | -------------------- | |
| 43 | +| Clients | HTTP clients: Socket, cURL and others | `Http\Client\[Name]` | |
| 44 | +| Client adapters | Adapters for other clients: Guzzle, React and others | `Http\Adapter\[Name]`| |
| 45 | +| Plugins | Implementation-independent authentication, cookies and more | `Http\Plugin\[Name]` | |
35 | 46 |
|
36 |
| -As explained above, PHP HTTP has room for anything that is connected to HTTP and PHP. |
37 |
| -Although [HTTPlug](http://httplug.io) is considered to be our "main product", we have other components as well. |
| 47 | +## The future |
38 | 48 |
|
39 |
| -See the list of components in the left side navigation. |
| 49 | +HTTPlug, a working example of an HTTP client interface, can serve as a basis |
| 50 | +for discussion around a future HTTP client PSR. |
0 commit comments