symfony/web-link

Manages links between resources

Installs: 13 990 645

Dependents: 170

Suggesters: 7

Security: 0

Stars: 1 077

Watchers: 7

Forks: 5

v5.3.0-BETA1 2021-03-22 15:30 UTC

This package is auto-updated.

Last update: 2021-04-18 06:44:29 UTC


README

The WebLink component manages links between resources. It is particularly useful to advise clients to preload and prefetch documents through HTTP and HTTP/2 pushes.

This component implements the HTML5's Links, Preload and Resource Hints W3C's specifications. It can also be used with extensions defined in the HTML5 link type extensions wiki.

Getting Started

$ composer require symfony/web-link
use Symfony\Component\WebLink\GenericLinkProvider;
use Symfony\Component\WebLink\HttpHeaderSerializer;
use Symfony\Component\WebLink\Link;

$linkProvider = (new GenericLinkProvider())
    ->withLink(new Link('preload', '/bootstrap.min.css'));

header('Link: '.(new HttpHeaderSerializer())->serialize($linkProvider->getLinks()));

echo 'Hello';

Resources