PSR-7 URI implementation.
- author Michael Dowling
- author Tobias Schultze
- author Matthew Weier O'Phinney
- Implements
JsonSerializable Psr\Http\Message\UriInterface Stringable
Methods |
public __construct(string $uri = '') |
public __toString() : string |
public static composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment) : string Composes a URI reference string from its various components. Usually this method does not need to be called manually but instead is used indirectly via PSR-7 UriInterface treats an empty component the same as a missing component as Another adjustment is that the authority separator is added even when the authority is missing/empty
|
public static fromParts(array $parts) : Psr\Http\Message\UriInterface Creates a URI from a hash of
|
public getAuthority() : string |
public getFragment() : string |
public getHost() : string |
public getPath() : string |
public getPort() : ?int |
public getQuery() : string |
public getScheme() : string |
public getUserInfo() : string |
public static isAbsolute(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is absolute, i.e. it has a scheme. An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true
|
public static isAbsolutePathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is termed an absolute-path reference.
|
public static isDefaultPort(Psr\Http\Message\UriInterface $uri) : bool Whether the URI has the default port of the current scheme.
|
public static isNetworkPathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a network-path reference. A relative reference that begins with two slash characters is termed an network-path reference.
|
public static isRelativePathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is termed a relative-path reference.
|
public static isSameDocumentReference(Psr\Http\Message\UriInterface $uri, ?Psr\Http\Message\UriInterface $base = NULL) : bool Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its fragment
|
public jsonSerialize() : string |
public withFragment( $fragment) : Psr\Http\Message\UriInterface |
public withHost( $host) : Psr\Http\Message\UriInterface |
public static withoutQueryValue(Psr\Http\Message\UriInterface $uri, string $key) : Psr\Http\Message\UriInterface Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the provided key are
|
public withPath( $path) : Psr\Http\Message\UriInterface |
public withPort( $port) : Psr\Http\Message\UriInterface |
public withQuery( $query) : Psr\Http\Message\UriInterface |
public static withQueryValue(Psr\Http\Message\UriInterface $uri, string $key, ?string $value) : Psr\Http\Message\UriInterface Creates a new URI with a specific query string value. Any existing query string values that exactly match the provided key are A value of null will set the query string key without a value, e.g. "key"
|
public static withQueryValues(Psr\Http\Message\UriInterface $uri, array $keyValueArray) : Psr\Http\Message\UriInterface Creates a new URI with multiple specific query string values. It has the same behavior as withQueryValue() but for an associative array of key => value.
|
public withScheme( $scheme) : Psr\Http\Message\UriInterface |
public withUserInfo( $user, $password = NULL) : Psr\Http\Message\UriInterface |
Constants |
private GuzzleHttp Sub-delims for use in a regex.
|
private GuzzleHttp Unreserved characters for use in a regex.
|
private GuzzleHttp |
private GuzzleHttp Absolute http and https URIs require a host per RFC 7230 Section 2.7 |
private GuzzleHttp |
Properties |
private $composedComponents = NULL
|
private $fragment = ''
|
private $host = ''
|
private $path = ''
|
private $port = NULL
|
private $query = ''
|
private $scheme = ''
|
private $userInfo = ''
|
Methods |
private applyParts(array $parts) : void Apply parse_url parts to a URI.
|
private filterHost( $host) : string
|
private filterPath( $path) : string Filters the path of a URI
|
private filterPort( $port) : ?int
|
private filterQueryAndFragment( $str) : string Filters the query string or fragment of a URI.
|
private filterScheme( $scheme) : string
|
private filterUserInfoComponent( $component) : string
|
private static generateQueryString(string $key, ?string $value) : string |
private static getFilteredQueryString(Psr\Http\Message\UriInterface $uri, array $keys) : array
|
private static parse(string $url) UTF-8 aware \parse_url() replacement. The internal function produces broken output for non ASCII domain names On the other hand, cURL understands IDN correctly only when UTF-8 locale
|
private rawurlencodeMatchZero(array $match) : string |
private removeDefaultPort() : void |
private validateState() : void |
Methods |
public static composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment) : string Composes a URI reference string from its various components. Usually this method does not need to be called manually but instead is used indirectly via PSR-7 UriInterface treats an empty component the same as a missing component as Another adjustment is that the authority separator is added even when the authority is missing/empty
|
public static fromParts(array $parts) : Psr\Http\Message\UriInterface Creates a URI from a hash of
|
private static generateQueryString(string $key, ?string $value) : string |
private static getFilteredQueryString(Psr\Http\Message\UriInterface $uri, array $keys) : array
|
public static isAbsolute(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is absolute, i.e. it has a scheme. An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true
|
public static isAbsolutePathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is termed an absolute-path reference.
|
public static isDefaultPort(Psr\Http\Message\UriInterface $uri) : bool Whether the URI has the default port of the current scheme.
|
public static isNetworkPathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a network-path reference. A relative reference that begins with two slash characters is termed an network-path reference.
|
public static isRelativePathReference(Psr\Http\Message\UriInterface $uri) : bool Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is termed a relative-path reference.
|
public static isSameDocumentReference(Psr\Http\Message\UriInterface $uri, ?Psr\Http\Message\UriInterface $base = NULL) : bool Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its fragment
|
private static parse(string $url) UTF-8 aware \parse_url() replacement. The internal function produces broken output for non ASCII domain names On the other hand, cURL understands IDN correctly only when UTF-8 locale
|
public static withoutQueryValue(Psr\Http\Message\UriInterface $uri, string $key) : Psr\Http\Message\UriInterface Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the provided key are
|
public static withQueryValue(Psr\Http\Message\UriInterface $uri, string $key, ?string $value) : Psr\Http\Message\UriInterface Creates a new URI with a specific query string value. Any existing query string values that exactly match the provided key are A value of null will set the query string key without a value, e.g. "key"
|
public static withQueryValues(Psr\Http\Message\UriInterface $uri, array $keyValueArray) : Psr\Http\Message\UriInterface Creates a new URI with multiple specific query string values. It has the same behavior as withQueryValue() but for an associative array of key => value.
|