https://github.com/symfony/web-link
Manages links between resources
https://github.com/symfony/web-link
component dns-prefetch http http2 link linkset performance php prefetch preload prerender psr13 push symfony symfony-component
Last synced: about 1 month ago
JSON representation
Manages links between resources
- Host: GitHub
- URL: https://github.com/symfony/web-link
- Owner: symfony
- License: mit
- Created: 2017-04-10T16:58:51.000Z (over 9 years ago)
- Default Branch: 8.2
- Last Pushed: 2026-10-09T14:18:46.000Z (about 2 months ago)
- Last Synced: 2026-10-18T11:25:20.504Z (about 1 month ago)
- Topics: component, dns-prefetch, http, http2, link, linkset, performance, php, prefetch, preload, prerender, psr13, push, symfony, symfony-component
- Language: PHP
- Homepage: https://symfony.com/web-link
- Size: 209 KB
- Stars: 1,416
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php - symfony/web-link - Manages links between resources (Web / HTTP and Networking Clients)
README
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](https://www.w3.org/TR/html5/links.html),
[Preload](https://www.w3.org/TR/preload/) and [Resource
Hints](https://www.w3.org/TR/resource-hints/) W3C's specifications. It can also
be used with extensions defined in the [HTML5 link type extensions
wiki](http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions).
It also implements [Web Linking](https://www.rfc-editor.org/rfc/rfc8288.html)
(RFC 8288), the two link set document formats defined by
[Linkset](https://www.rfc-editor.org/rfc/rfc9264.html) (RFC 9264) and the
[Link-Template](https://www.rfc-editor.org/rfc/rfc9652.html) HTTP header field
(RFC 9652).
Getting Started
---------------
```bash
composer require symfony/web-link
```
```php
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';
```
Sponsor
-------
This package is looking for a [backer][1].
Help Symfony by [sponsoring][3] its development!
Resources
---------
* [Documentation](https://symfony.com/doc/current/web_link.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)
[1]: https://symfony.com/backers
[3]: https://symfony.com/sponsor