Skip to content

Commit b862a10

Browse files
wouterjfabpot
authored andcommitted
[DotEnv][WebLink][Templating][ErrorHandler] Updated README with minimal example
1 parent 6dd2110 commit b862a10

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,30 @@ This component implements the [HTML5's Links](https://www.w3.org/TR/html5/links.
88
and [Resource Hints](https://www.w3.org/TR/resource-hints/) W3C's specifications.
99
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).
1010

11+
Getting Started
12+
---------------
13+
14+
```
15+
$ composer require symfony/web-link
16+
```
17+
18+
```php
19+
use Symfony\Component\WebLink\GenericLinkProvider;
20+
use Symfony\Component\WebLink\HttpHeaderSerializer;
21+
use Symfony\Component\WebLink\Link;
22+
23+
$linkProvider = (new GenericLinkProvider())
24+
->withLink(new Link('preload', '/bootstrap.min.css'));
25+
26+
header('Link: '.(new HttpHeaderSerializer())->serialize($linkProvider->getLinks()));
27+
28+
echo 'Hello';
29+
```
30+
1131
Resources
1232
---------
1333

14-
* [Documentation](https://symfony.com/doc/current/components/web_link.html)
34+
* [Documentation](https://symfony.com/doc/current/web_link.html)
1535
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
1636
* [Report issues](https://github.com/symfony/symfony/issues) and
1737
[send Pull Requests](https://github.com/symfony/symfony/pulls)

0 commit comments

Comments
 (0)