-
Notifications
You must be signed in to change notification settings - Fork 0
Psr7 Compatibility
Adding Psr7 support seems like a no-brainer, however, there are a number of compatibility issues that concern me. If you have input about compatibility with Psr7, please feel free to open an issue and share your thoughts.
Keep in mind that the URL object from the WHATWG URL standard MUST resolve to an absolute URL.
-
Psr7 requires strict compliance with RFC 3986. This technically makes the WHATWG URL standard incompatible, as it is an amalgam of RFC 3986, RFC 3987 and other rules, with the goal of superseeding both RFC 3986 and RFC 3987.
-
Psr7's
UriInterface
states that it MUST be treated as an immutable object, whereas the WHATWG URL object is treated as a mutable object. -
UriInterface::withScheme()
states that passing the empty string is equivilent to removing the scheme. The WHATWG spec only allows schemes to be changed to another valid scheme, not removed. -
Like the above,
UriInterface::withHost()
states that passing the empty string is equivilent to removing the host. The URL object only allows the removal of the host if the associated scheme is not http, https, ftp, gopher, ws, or wss.
-
- We accept the WHATWG URL standard as the defacto standard for parsing URLs and forget about strict compliance with RFC 3986.
- We jump through a bunch of hoops to transform the parsed data to be RFC 3986 compliant.
-
- We slap the
UriInterface
on theURL
object and accept that the object can be treated as both mutable and immutable. - We create a separate concrete class that is always treated as immutable.
- We slap the
-
- We throw an
\InvalidArgumentException
whenever the empty string is passed.
- We throw an
-
- We throw an
\InvalidArgumentException
whenever the empty string causes the parser to fail.
- We throw an