8000 minor #13487 [HttpClient] Document AMPHP HttpClient integration for H… · symfony/symfony-docs@6e9eb32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e9eb32

Browse files
committed
minor #13487 [HttpClient] Document AMPHP HttpClient integration for HTTP/2 (wouterj)
This PR was merged into the master branch. Discussion ---------- [HttpClient] Document AMPHP HttpClient integration for HTTP/2 Fixes #13293 Just below the shown diff, there is this paragraph: ```rst Support for HTTP/2 PUSH works out of the box when libcurl >= 7.61 is used with PHP >= 7.2.17 / 7.3.4: pushed responses are put into a temporary cache and are used when a subsequent request is triggered for the corresponding URLs. ``` Should AMPHP also be added here? Commits ------- e0a4905 Document AMPHP HttpClient integration for HTTP/2
2 parents 8adf5de + e0a4905 commit 6e9eb32

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

compo 10000 nents/http_client.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ with HTTP/2 and with doing concurrent asynchronous streamed and multiplexed
4646
requests/responses. Even when doing regular synchronous calls, this design
4747
allows keeping connections to remote hosts open between requests, improving
4848
performance by saving repetitive DNS resolution, SSL negotiation, etc.
49-
To leverage all these design benefits, the cURL extension is needed.
5049

5150
Enabling cURL Support
5251
~~~~~~~~~~~~~~~~~~~~~
5352

5453
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.
5756

5857
``HttpClient::create()`` selects the cURL transport if the `cURL PHP extension`_
5958
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.
7574
HTTP/2 Support
7675
~~~~~~~~~~~~~~
7776

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 8F0C `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::
8192

8293
$client = HttpClient::create(['http_version' => '2.0']);
8394

@@ -1021,3 +1032,5 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
10211032
.. _`PSR-18`: https://www.php-fig.org/psr/psr-18/
10221033
.. _`HTTPlug`: https://github.com/php-http/httplug/#readme
10231034
.. _`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

Comments
 (0)
0