HTTP/2 Server Push with Curl in PHP 7.1
PHP 7 already comes with some support for HTTP/2 specific features, but now there is a new proposal for server push in PHP up for review using HTTP/2. Davey Shafik has written an RFC that aims for exposing the new Server Push features from libcurl to the userland in PHP 7.1:
Server push allows the server to push additional resources relevant to the requested resource directly to the client proactively. This allows developers to push render critical assets such as stylesheets or initial JSON data payload for single page applications.
Considering how far the original HTTP has been stretched from it's context it is likely that there is a wealth of ways that Server Push will be used in the future on the web.
PHP 7.0.0 is close to a release with the hopes that the current Release Candidate (RC7) is the final one, so it'll take a while before this functionality would be native in PHP, but in the meanwhile you can go ahead and simply send the headers with the Symfony HttpKernel, for example: HTTP/2 Server Push with the Symfony HttpKernel
It is good to see active development of PHP 7 already before the launch. Like in many other projects, less is more and adding features such as server push in a planned point release is a great way forward.
Read more about HTTP/2:
- HTTP/2 Server Push (with the Symfony HttpKernel)
- Serving PHP on HTTP/2 with H2O and HHVM (Symfony, WordPress, Drupal...)
- Migrating large sites to HTTP/2
- HTTP/2 2015 Retrospective
- Comparing HTTP/1.1 and HTTP/2 on Aircraft WiFi
- Free SSL Certificates from Let's Encrypt to Drive HTTP/2 Adoption
- Varnish HTTP/2 with SSL/TLS offloading on H2O
- What is HTTP/2 and how to deploy it?