@@ -854,14 +854,26 @@ To leverage all these design benefits, the cURL extension is needed.
854
854
Enabling cURL Support
855
855
~~~~~~~~~~~~~~~~~~~~~
856
856
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, `AmpHttpClient `_ 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 AmpHttpClient.
861
+
862
+ .. note ::
863
+
864
+ To use the `AmpHttpClient `_, the `amphp/http-client `_ package must be
865
+ installed.
866
+
867
+ .. versionadded :: 5.1
868
+
869
+ Integration with ``amphp/http-client `` was introduced in Symfony 5.1.
860
870
861
871
The :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::
865
877
866
878
use Symfony\Component\HttpClient\CurlHttpClient;
867
879
use Symfony\Component\HttpClient\NativeHttpClient;
@@ -874,7 +886,7 @@ explicitly, use the following classes to create the client::
874
886
875
887
When using this component in a full-stack Symfony application, this behavior is
876
888
not 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 .
889
+ is installed and enabled, and will fall back as explained above .
878
890
879
891
Configuring CurlHttpClient Options
880
892
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2055,3 +2067,4 @@ test it in a real application::
2055
2067
.. _`EventSource` : https://www.w3.org/TR/eventsource/#eventsource
2056
2068
.. _`idempotent method` : https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods
2057
2069
.. _`SSRF` : https://portswigger.net/web-security/ssrf
2070
+ .. _`AmpHttpClient` : https://github.com/amphp/http-client
0 commit comments