@@ -46,14 +46,13 @@ with HTTP/2 and with doing concurrent asynchronous streamed and multiplexed
46
46
requests/responses. Even when doing regular synchronous calls, this design
47
47
allows keeping connections to remote hosts open between requests, improving
48
48
performance by saving repetitive DNS resolution, SSL negotiation, etc.
49
- To leverage all these design benefits, the cURL extension is needed.
50
49
51
50
Enabling cURL Support
52
51
~~~~~~~~~~~~~~~~~~~~~
53
52
54
53
This component supports both the native PHP streams and cURL to make the HTTP
55
- requests. Although both are interchangeable and provide the same features,
56
- including concurrent requests, HTTP/2 is only supported when using cURL .
54
+ requests. Both are interchangeable and provide the same features, including
55
+ concurrent requests and HTTP/2 support .
57
56
58
57
``HttpClient::create() `` selects the cURL transport if the `cURL PHP extension `_
59
58
is enabled and falls back to PHP streams otherwise. If you prefer to select
@@ -75,9 +74,21 @@ is installed and enabled. Otherwise, the native PHP streams will be used.
75
74
HTTP/2 Support
76
75
~~~~~~~~~~~~~~
77
76
78
- When requesting an ``https `` URL, HTTP/2 is enabled by default if libcurl >= 7.36
79
- is used. To force HTTP/2 for ``http `` URLs, you need to enable it explicitly via
80
- the ``http_version `` option::
77
+ .. versionadded :: 5.1
78
+
79
+ Integration with ``amphp/http-client `` was introduced in Symfony 5.1.
80
+ Prior to this version, HTTP/2 was only supported when ``libcurl `` was
81
+ installed.
82
+
83
+ The component supports HTTP/2 if one of the following tools is
84
+ installed:
85
+
86
+ * The `libcurl `_ package version 7.36 or higher;
87
+ * The `amphp/http-client `_ Packagist package version 4.2 or higher.
88
+
89
+ When requesting an ``https `` URL and HTTP/2 is supported by your server,
90
+ HTTP/2 is enabled by default. To force HTTP/2 for ``http `` URLs, you need
91
+ to enable it explicitly via the ``http_version `` option::
81
92
82
93
$client = HttpClient::create(['http_version' => '2.0']);
83
94
@@ -1021,3 +1032,5 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
1021
1032
.. _`PSR-18` : https://www.php-fig.org/psr/psr-18/
1022
1033
.. _`HTTPlug` : https://github.com/php-http/httplug/#readme
1023
1034
.. _`Symfony Contracts` : https://github.com/symfony/contracts
1035
+ .. _`libcurl` : https://curl.haxx.se/libcurl/
1036
+ .. _`amphp/http-client` : https://packagist.org/packages/amphp/http-client
0 commit comments