1
1
Clients & Adapters
2
2
==================
3
3
4
- There are clients implementing one of the HTTPlug interfaces directly,
5
- and adapter packages that implement the interface and forward the calls to HTTP clients not implementing the interface.
4
+ There are two types of libraries you can use to send HTTP messages; clients and adapters. A client implements the
5
+ ``HttpClient `` and/or the ``HttpAsyncClient `` interfaces directly. A client adapter is a class implementing the
6
+ interface and forwarding the calls to an HTTP client not implementing the interface. (See `Adapter pattern `_ on Wikipedia).
6
7
7
- .. _`php-http/client-implementation` : https://packagist.org/providers/php-http/client-implementation
8
- .. _`php-http/async-client-implementation` : https://packagist.org/providers/php-http/async-client-implementation:
8
+ .. note ::
9
9
10
+ All clients and adapters comply with `Liskov substitution principle `_ which means that you can easily change one
11
+ for another without any side effects.
10
12
11
13
Clients:
12
14
@@ -29,9 +31,13 @@ Composer Virtual Packages
29
31
-------------------------
30
32
31
33
Virtual packages are a way to specify the dependency on an implementation of an interface-only repository
32
- without forcing a specific implementation. For HTTPlug, the virtual package is called ``php-http/client-implementation ``.
34
+ without forcing a specific implementation. For HTTPlug, the virtual packages are called `php-http/client-implementation `_
35
+ and `php-http/async-client-implementation `_.
33
36
34
- There is no project registered with that name . However, all client implementations including client adapters for
37
+ There is no library registered with those names . However, all client implementations ( including client adapters) for
35
38
HTTPlug use the ``provide `` section to tell composer that they do provide the client-implementation.
36
39
37
-
40
+ .. _`php-http/client-implementation` : https://packagist.org/providers/php-http/client-implementation
41
+ .. _`php-http/async-client-implementation` : https://packagist.org/providers/php-http/async-client-implementation
42
+ .. _`Adapter pattern` : https://en.wikipedia.org/wiki/Adapter_pattern
43
+ .. _`Liskov substitution principle` : https://en.wikipedia.org/wiki/Liskov_substitution_principle
0 commit comments