phasync
Uri / __construct

Method

Uri::__construct

Creates a URI from $uri.

Description#

public Uri::__construct(
    UriInterface|string $uri
)

The string form is normalised as the getters are: the scheme and host in lower case, no port when it is the scheme's default, and characters RFC 3986 does not allow percent-encoded (an existing "%xx" is never encoded twice). A URI that is already normal is kept exactly as given.

Parameters#

$uri UriInterface|string
An absolute URL, or a relative reference

Errors / Exceptions#

ExceptionWhen
InvalidArgumentExceptionWhen $uri cannot be parsed, e.g. 'http:///x' or a port above 65535