From 4b5e8905a4ac35ea7e96d969b10603980e6e2eb8 Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Mon, 8 Jul 2024 20:45:11 +0200 Subject: [PATCH] Documenting the difference between PSR-7 and League URI --- docs/uri/7.0/psr-compliance.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/uri/7.0/psr-compliance.md b/docs/uri/7.0/psr-compliance.md index 767b4496..c068d525 100644 --- a/docs/uri/7.0/psr-compliance.md +++ b/docs/uri/7.0/psr-compliance.md @@ -88,6 +88,21 @@ echo json_encode(Http::new('http://example.com/path/to?q=foo%20bar#section-42')) // display "http:\/\/example.com\/path\/to?q=foo%20bar#section-42" ~~~ +### Differences with the Generic RFC3986 URI + +Because of its normalization rules a `PSR-7` UriInterface implementing object +may return a different URI representation than a generic URI implementing class. + +~~~php +echo (string) Http::new('http://example.com/path/to?#'); +// returns 'http://example.com/path/to + +echo (string) Uri::new('http://example.com/path/to?#'); +// returns 'http://example.com/path/to?#' +~~~ + +

This improved compliance is available since version 7.5.0

+ ## PSR-17 compatibility The package also provides an implementation of the `UriFactoryInterface` from [PSR-17](https://www.php-fig.org/psr/psr-17/)