> On Jun 28, 2024, at 15:09, Máté Kocsis <kocsismat...@gmail.com> wrote:
> 
> 
> Hi Everyone,
> 
> I've been working on a new RFC for a while now, and time has come to present 
> it to a wider audience.
> 
> Last year, I learnt that PHP doesn't have built-in support for parsing URLs 
> according to any well established standards (RFC 1738 or the WHATWG URL 
> living standard), since the parse_url() function is optimized for performance 
> instead of correctness.
> 
> In order to improve compatibility with external tools consuming URLs (like 
> browsers), my new RFC would add a WHATWG compliant URL parser functionality 
> to the standard library. The API itself is not final by any means, the RFC 
> only represents how I imagined it first.
> 
> You can find the RFC at the following link: 
> https://wiki.php.net/rfc/url_parsing_api
> 
> Regards,
> Máté


The RFC states:

<snip>
The Url\Url class is intentionally compatible with the PSR-7 UriInterface.
</snip>

It mirrors the interface, but it can’t be swapped out for a UriInterface 
instance, especially since it can’t be extended, so I wouldn’t consider it 
compatible. I would still need to write a compatibility layer that composes 
Url\Url and implements UriInterface.

<snip>
This makes it possible for a next iteration of the PSR-7 standard to use 
Url\Url directly instead of requiring implementations to provide their own 
Psr\Http\Message\UriInterface implementation.
</snip>

Since PSRs are concerned with shared interfaces and this class is final and 
does not implement any interfaces, I’m not sure how you envision “a next 
iteration” of PSR-7 to use this directly, unless what you mean is that 
UriInterface would be deprecated and applications would type directly against 
Url\Url.

Cheers,
Ben

Reply via email to