UriUtil
in package
Table of Contents
Constants
- URI_DEFAULT_PORTS = ['http' => 80, 'https' => 443, 'ftp' => 21, 'gopher' => 70, 'nntp' => 119, 'news' => 119, 'telnet' => 23, 'tn3270' => 23, 'imap' => 143, 'pop' => 110, 'ldap' => 389]
Methods
- isAbsolute() : bool
- Checks Whether the URI is absolute, i.e. it has a scheme.
- isAbsolutePathReference() : bool
- Checks Whether the URI is an absolute-path reference.
- isDefaultPort() : bool
- Checks whether the UriInterface has a port set and if that port is one of the default ports for the given scheme
- isNetworkPathReference() : bool
- Checks Whether the URI is a network-path reference.
- isRelativePathReference() : bool
- Checks Whether the URI is a relative-path reference.
- parseUrl() : array{scheme?: string, host?: int|string, port?: string, user?: string, pass?: string, path?: string, query?: string, fragment?: string}|null
- UTF-8 aware \parse_url() replacement.
- withoutQueryValue() : UriInterface
- Removes a specific query string value.
- withQueryValue() : UriInterface
- Adds a specific query string value.
Constants
URI_DEFAULT_PORTS
public
mixed
URI_DEFAULT_PORTS
= ['http' => 80, 'https' => 443, 'ftp' => 21, 'gopher' => 70, 'nntp' => 119, 'news' => 119, 'telnet' => 23, 'tn3270' => 23, 'imap' => 143, 'pop' => 110, 'ldap' => 389]
Methods
isAbsolute()
Checks Whether the URI is absolute, i.e. it has a scheme.
public
static isAbsolute(UriInterface $uri) : bool
An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, the base URI. Relative references can be divided into several forms:
- network-path references, e.g. '//example.com/path'
- absolute-path references, e.g. '/path'
- relative-path references, e.g. 'subpath'
Parameters
- $uri : UriInterface
Tags
Return values
boolisAbsolutePathReference()
Checks Whether the URI is an absolute-path reference.
public
static isAbsolutePathReference(UriInterface $uri) : bool
A relative reference that begins with a single slash character is termed an absolute-path reference.
Parameters
- $uri : UriInterface
Tags
Return values
boolisDefaultPort()
Checks whether the UriInterface has a port set and if that port is one of the default ports for the given scheme
public
static isDefaultPort(UriInterface $uri) : bool
Parameters
- $uri : UriInterface
Return values
boolisNetworkPathReference()
Checks Whether the URI is a network-path reference.
public
static isNetworkPathReference(UriInterface $uri) : bool
A relative reference that begins with two slash characters is termed a network-path reference.
Parameters
- $uri : UriInterface
Tags
Return values
boolisRelativePathReference()
Checks Whether the URI is a relative-path reference.
public
static isRelativePathReference(UriInterface $uri) : bool
A relative reference that does not begin with a slash character is termed a relative-path reference.
Parameters
- $uri : UriInterface
Tags
Return values
boolparseUrl()
UTF-8 aware \parse_url() replacement.
public
static parseUrl(string $url) : array{scheme?: string, host?: int|string, port?: string, user?: string, pass?: string, path?: string, query?: string, fragment?: string}|null
The internal function produces broken output for non ASCII domain names (IDN) when used with locales other than "C".
On the other hand, cURL understands IDN correctly only when UTF-8 locale is configured ("C.UTF-8", "en_US.UTF-8", etc.).
Parameters
- $url : string
Tags
Return values
array{scheme?: string, host?: int|string, port?: string, user?: string, pass?: string, path?: string, query?: string, fragment?: string}|nullwithoutQueryValue()
Removes a specific query string value.
public
static withoutQueryValue(UriInterface $uri, string $key) : UriInterface
Any existing query string values that exactly match the provided $key are removed.
Parameters
- $uri : UriInterface
- $key : string
Return values
UriInterfacewithQueryValue()
Adds a specific query string value.
public
static withQueryValue(UriInterface $uri, string $key[, string|null $value = null ]) : UriInterface
Any existing query string values that exactly match the provided $key are removed and replaced with the given $key $value pair.
A value of null will set the query string key without a value, e.g. "key" instead of "key=value".
Parameters
- $uri : UriInterface
- $key : string
- $value : string|null = null