This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/WebLink
Nicolas Grekas 65f2620bc4 Merge branch '4.4' into 5.1
* 4.4:
  fix merge
  Remove branch-version (keep them for contracts only)
  [HttpClient] relax auth bearer format requirements
  [PHPUnitBridge] Silence errors from mkdir()
  [DependencyInjection] Preload classes with union types correctly.
  [Serializer] fix decoding float XML attributes starting with 0
  add missing dutch translations
  Support PHPUnit 8 and PHPUnit 9 in constraint compatibility trait
  Add expectDeprecation, expectNotice, expectWarning, and expectError to TestCase polyfill
  Add missing exporter function for PHPUnit 7
  [Validator] Add missing romanian translations
  [Cache] Use correct expiry in ChainAdapter
  do not translate null placeholders or titles
2020-10-24 14:01:57 +02:00
..
EventListener [DI] fix preloading script generation 2020-03-17 20:51:46 +01:00
Tests fix tests mocking final events 2019-09-05 22:36:38 +02:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore Add a new Link component 2017-04-10 09:55:52 -07:00
CHANGELOG.md [WebLink] implement PSR-13 directly 2019-08-12 15:51:36 +02:00
composer.json Merge branch '4.4' into 5.1 2020-10-24 14:01:57 +02:00
GenericLinkProvider.php Import return annotations from vendors 2019-08-14 15:27:41 +02:00
HttpHeaderSerializer.php Add return types to tests and final|internal|private methods 2019-08-21 17:14:41 +02:00
LICENSE Update year in license files 2020-01-01 12:03:25 +01:00
Link.php Import return annotations from vendors 2019-08-14 15:27:41 +02:00
phpunit.xml.dist Merge branch '2.8' into 3.4 2018-11-11 20:48:54 +01:00
README.md [DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example 2020-05-26 11:42:42 +02:00

WebLink Component

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