Symfony HttpClient component has provided full HTTP/2 support since day one when the cURL PHP extension was installed on your machine. In Symfony 5.1 we've improved the HTTP client to provide a portable HTTP/2 implementation which doesn't require installing cURL.
The amphp/http-client library provides an async HTTP/1.1+2 client for PHP
based on Amp (a non-blocking concurrency framework for PHP applications).
The amphp/http-client
manually implements HTTP over TCP sockets, so it has
no dependency on the cURL extension.
In Symfony 5.1, Symfony HttpClient has been improved to detect not only cURL but also the Amp HTTP client. Therefore, HTTP/2 is enabled if one of the following tools is installed:
- The
libcurl
library version 7.36 or higher; - The
amphp/http-client
PHP package version 4.2 or higher.
You won't need to do or configure anything else. Just upgrade to Symfony 5.1,
install amphp/http-client
and you'll have a portable HTTP/2 implementation.