Symfony News

New in Symfony 3.3: WebLink component

Kévin Dunglas

Contributed by
Kévin Dunglas
in #22273.

A few weeks ago, we added support for asset preloading with HTTP/2 Push. The feedback was so enthusiastic that we decided to improve and expand this feature. In fact, we decided to create a whole new component for it: WebLink.

This new component manages links between resources, not only assets; advising browsers to preload and prefetch resources through HTTP and HTTP/2 pushes. The component implements these specifications: HTML5 Links, Preload, and Resource Hints

All these new features can be used via several Twig functions:

  • link(), adds the Link HTTP header;
  • preload(), preload resources (not only assets);
  • dns_prefetch(), resolves a resource origin as early as possible;
  • preconnect(), initiates a early connection to a resource (including DNS resolution, TCP handshake, and TLS negotiation);
  • prefetch(), indicates to the client that it should prefetch the given resource;
  • prerender(), indicates to the client that it should prerender the given resource.

Unlike the previous preloading feature, this component is not only useful for web assets. Being a standalone component means that it can also be used for example to replace resource embedding by HTTP/2 pushes in your APIs.


Be trained by Symfony experts - 2017-05-02 Paris - 2017-05-02 Paris - 2017-05-04 Paris


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook