@@ -980,15 +980,24 @@ To leverage all these design benefits, the cURL extension is needed.
980
980
Enabling cURL Support
981
981
~~~~~~~~~~~~~~~~~~~~~
982
982
983
- This component supports both the native PHP streams and cURL to make the HTTP
984
- requests. Although both are interchangeable and provide the same features,
985
- including concurrent requests, HTTP/2 is only supported when using cURL.
983
+ This component can make HTTP requests using native PHP streams and the
984
+ ``amphp/http-client `` and cURL libraries. Although they are interchangeable and
985
+ provide the same features, including concurrent requests, HTTP/2 is only supported
986
+ when using cURL or ``amphp/http-client ``.
987
+
988
+ .. note ::
989
+
990
+ To use the :class: `Symfony\\ Component\\ HttpClient\\ AmpHttpClient `, the
991
+ `amphp/http-client `_ package must be installed.
986
992
987
993
The :method: `Symfony\\ Component\\ HttpClient\\ HttpClient::create ` method
988
- selects the cURL transport if the `cURL PHP extension `_ is enabled and falls
989
- back to PHP streams otherwise. If you prefer to select the transport
990
- explicitly, use the following classes to create the client::
994
+ selects the cURL transport if the `cURL PHP extension `_ is enabled. It falls
995
+ back to ``AmpHttpClient `` if cURL couldn't be found or is too old. Finally, if
996
+ ``AmpHttpClient `` is not available, it falls back to PHP streams.
997
+ If you prefer to select the transport explicitly, use the following classes
998
+ to create the client::
991
999
1000
+ use Symfony\Component\HttpClient\AmpHttpClient;
992
1001
use Symfony\Component\HttpClient\CurlHttpClient;
993
1002
use Symfony\Component\HttpClient\NativeHttpClient;
994
1003
@@ -998,9 +1007,12 @@ explicitly, use the following classes to create the client::
998
1007
// uses the cURL PHP extension
999
1008
$client = new CurlHttpClient();
1000
1009
1010
+ // uses the client from the `amphp/http-client` package
1011
+ $client = new AmpHttpClient();
1012
+
1001
1013
When using this component in a full-stack Symfony application, this behavior is
1002
1014
not configurable and cURL will be used automatically if the cURL PHP extension
1003
- is installed and enabled. Otherwise, the native PHP streams will be used .
1015
+ is installed and enabled, and will fall back as explained above .
1004
1016
1005
1017
Configuring CurlHttpClient Options
1006
1018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1050,7 +1062,7 @@ HTTP/2 Support
1050
1062
When requesting an ``https `` URL, HTTP/2 is enabled by default if one of the
1051
1063
following tools is installed:
1052
1064
1053
- * The `libcurl `_ package version 7.36 or higher;
1065
+ * The `libcurl `_ package version 7.36 or higher, used with PHP >= 7.2.17 / 7.3.4 ;
1054
1066
* The `amphp/http-client `_ Packagist package version 4.2 or higher.
1055
1067
1056
1068
To force HTTP/2 for ``http `` URLs, you need to enable it explicitly via the
@@ -1100,9 +1112,9 @@ To force HTTP/2 for ``http`` URLs, you need to enable it explicitly via the
1100
1112
1101
1113
$client = HttpClient::create(['http_version' => '2.0']);
1102
1114
1103
- Support for HTTP/2 PUSH works out of the box when libcurl >= 7.61 is used with
1104
- PHP >= 7.2.17 / 7.3.4: pushed responses are put into a temporary cache and are
1105
- used when a subsequent request is triggered for the corresponding URLs.
1115
+ Support for HTTP/2 PUSH works out of the box when using a compatible client:
1116
+ pushed responses are put into a temporary cache and are used when a
1117
+ subsequent request is triggered for the corresponding URLs.
1106
1118
1107
1119
Processing Responses
1108
1120
--------------------
0 commit comments