@@ -854,15 +854,28 @@ To leverage all these design benefits, the cURL extension is needed.
854854Enabling cURL Support
855855~~~~~~~~~~~~~~~~~~~~~
856856
857- This component supports both the native PHP streams and cURL to make the HTTP
858- requests. Although both are interchangeable and provide the same features,
859- including concurrent requests, HTTP/2 is only supported when using cURL.
857+ This component supports the native PHP streams, ``amphp/http-client `` and cURL to
858+ make the HTTP requests. Although they are interchangeable and provide the
859+ same features, including concurrent requests, HTTP/2 is only supported when
860+ using cURL or ``amphp/http-client ``.
861+
862+ .. note ::
863+
864+ To use the :class: `Symfony\\ Component\\ HttpClient\\ AmpHttpClient `, the
865+ `amphp/http-client `_ package must be installed.
866+
867+ .. versionadded :: 5.1
868+
869+ Integration with ``amphp/http-client `` was introduced in Symfony 5.1.
860870
861871The :method: `Symfony\\ Component\\ HttpClient\\ HttpClient::create ` method
862- selects the cURL transport if the `cURL PHP extension `_ is enabled and falls
863- back to PHP streams otherwise. If you prefer to select the transport
864- explicitly, use the following classes to create the client::
872+ selects the cURL transport if the `cURL PHP extension `_ is enabled. It falls
873+ back to ``AmpHttpClient `` if cURL couldn't be found or is too old. Finally, if
874+ ``AmpHttpClient `` is not available, it falls back to PHP streams.
875+ If you prefer to select the transport explicitly, use the following classes
876+ to create the client::
865877
878+ use Symfony\Component\HttpClient\AmpHttpClient;
866879 use Symfony\Component\HttpClient\CurlHttpClient;
867880 use Symfony\Component\HttpClient\NativeHttpClient;
868881
@@ -872,9 +885,12 @@ explicitly, use the following classes to create the client::
872885 // uses the cURL PHP extension
873886 $client = new CurlHttpClient();
874887
888+ // uses the client from the `amphp/http-client` package
889+ $client = new AmpHttpClient();
890+
875891When using this component in a full-stack Symfony application, this behavior is
876892not configurable and cURL will be used automatically if the cURL PHP extension
877- is installed and enabled. Otherwise, the native PHP streams will be used .
893+ is installed and enabled, and will fall back as explained above .
878894
879895Configuring CurlHttpClient Options
880896~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -928,7 +944,7 @@ HTTP/2 Support
928944When requesting an ``https `` URL, HTTP/2 is enabled by default if one of the
929945following tools is installed:
930946
931- * The `libcurl `_ package version 7.36 or higher;
947+ * The `libcurl `_ package version 7.36 or higher, used with PHP >= 7.2.17 / 7.3.4 ;
932948* The `amphp/http-client `_ Packagist package version 4.2 or higher.
933949
934950.. versionadded :: 5.1
@@ -984,9 +1000,9 @@ To force HTTP/2 for ``http`` URLs, you need to enable it explicitly via the
9841000
9851001 $client = HttpClient::create(['http_version' => '2.0']);
9861002
987- Support for HTTP/2 PUSH works out of the box when libcurl >= 7.61 is used with
988- PHP >= 7.2.17 / 7.3.4: pushed responses are put into a temporary cache and are
989- used when a subsequent request is triggered for the corresponding URLs.
1003+ Support for HTTP/2 PUSH works out of the box when using a compatible client:
1004+ pushed responses are put into a temporary cache and are used when a
1005+ subsequent request is triggered for the corresponding URLs.
9901006
9911007Processing Responses
9921008--------------------
0 commit comments