Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

New in Symfony 5.1: Portable HTTP/2 implementation

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.

New in Symfony 5.1: Portable HTTP/2 implementation

Tweet this


Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.