Skip to content

Commit b855a44

Browse files
committed
Fix documentation
1 parent e77df2c commit b855a44

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

docs/uri/7.0/psr-compliance.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PSR interoperability
88

99
As we are dealing with URI, the package provides classes compliant
1010
with [PSR-7](https://www.php-fig.org/psr/psr-7/) and [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-13](https://www.php-fig.org/psr/psr-13/). This
11-
is done to allow more interoperability amongs PHP packages.
11+
is done to allow more interoperability amongst PHP packages.
1212

1313
## PSR-7 compatibility
1414

@@ -131,3 +131,30 @@ $uriFactory = new HttpFactory();
131131
$uri = $uriFactory->createUri('http://example.com/path/to?q=foo%20bar#section-42');
132132
echo $uri::class; // display League\Uri\Http
133133
~~~
134+
135+
## PSR-13 compatibility
136+
137+
<p class="message-notice">Available since <code>version 7.6</code></p>
138+
139+
To allow easier integration with other PHP packages and especially [PSR-13](https://www.php-fig.org/psr/psr-13/)
140+
the `UriTemplate` class implements the `Stringable` interface.
141+
142+
~~~php
143+
use League\Uri\UriTemplate;
144+
use Symfony\Component\WebLink\Link;
145+
146+
$uriTemplate = new UriTemplate('https://google.com/search{?q*}');
147+
148+
$link = (new Link())
149+
->withHref($uriTemplate)
150+
->withRel('next')
151+
->withAttribute('me', 'you');
152+
153+
// Once serialized will return
154+
// '<https://google.com/search{?q*}>; rel="next"; me="you"'
155+
~~~
156+
157+
The `Symfony\Component\WebLink\Link` package implements `PSR-13` interfaces.
158+
159+
<p class="message-info">You could already use a <code>Uri</code> instance if the link must use a
160+
concrete URI instead as the class also implements the <code>Stringable</code> interface.</p>

0 commit comments

Comments
 (0)