New in Symfony 5.1: Portable HTTP/2 implementation
April 7, 2020 • Published by Javier Eguiluz
Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.
Contributed by
Nicolas Grekas
in #35924.
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.
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.