Uri
    
            
            in package
            
        
    
            
            implements
                            UriInterface                    
    
    
        
        
    
Interfaces, Classes and Traits
Table of Contents
- ASCII = " eiasntrolud][cmp' g|hv.fb,:=-q10C2*yx)(L9AS/P"EjMIk3>5T<D4}B{8FwR67UGN;JzV#HOW_&!K?XQ%Y\ Z+~^$@` "
 - All ASCII letters sorted by typical frequency of occurrence.
 - HOST_ADDRESS_BLOCK = "��"
 - Significant 10 bits of IP to detect Zone ID regular expression pattern.
 - REGEXP_BINARY = ',(;|^)base64$,'
 - Base64 content regular expression pattern.
 - REGEXP_CHARS_SUBDELIM = "\!$&'\(\)\*\+,;\=%"
 - RFC3986 Sub delimiter characters regular expression pattern.
 - REGEXP_CHARS_UNRESERVED = 'A-Za-z0-9_\-\.~'
 - RFC3986 unreserved characters regular expression pattern.
 - REGEXP_FILE_PATH = ',^(?<delim>/)?(?<volume>[a-zA-Z])(?:[:|\|]|%7C)(?<rest>.*)?,'
 - Regular expression pattern to for file URI.
 - REGEXP_HOST_GEN_DELIMS = '/[:\/?#\[\]@ ]/'
 - RFC3986 delimiters of the generic URI components regular expression pattern.
 - REGEXP_HOST_IPFUTURE = '/^ v(?<version>[A-F0-9])+\. (?: (?<unreserved>[a-z0-9_~\-\.])| (?<sub_delims>[!$&'()*+,;=:]) # also include the : character )+ $/ix'
 - RFC3986 IPvFuture regular expression pattern.
 - REGEXP_HOST_PORT = ',^(?<host>(\[.*]|[^:])*)(:(?<port>[^/?#]*))?$,x'
 - RFC3986 IPvFuture host and port component.
 - REGEXP_HOST_REGNAME = '/^( (?<unreserved>[a-z0-9_~\-\.])| (?<sub_delims>[!$&'()*+,;=])| (?<encoded>%[A-F0-9]{2}) )+$/x'
 - RFC3986 host identified by a registered name regular expression pattern.
 - REGEXP_INVALID_CHARS = '/[\x00-\x1f\x7f]/'
 - RFC3986 invalid characters.
 - REGEXP_MIMETYPE = ',^\w+/[-.\w]+(?:\+[-.\w]+)?$,'
 - Mimetype regular expression pattern.
 - REGEXP_SCHEME = ',^[a-z]([-a-z0-9+.]+)?$,i'
 - RFC3986 schema regular expression pattern.
 - REGEXP_WINDOW_PATH = ',^(?<root>[a-zA-Z][:|\|]),'
 - Windows file path string regular expression pattern.
 - SCHEME_DEFAULT_PORT = ['data' => null, 'file' => null, 'ftp' => 21, 'gopher' => 70, 'http' => 80, 'https' => 443, 'ws' => 80, 'wss' => 443]
 - Supported schemes and corresponding default port.
 - SCHEME_VALIDATION_METHOD = ['data' => 'isUriWithSchemeAndPathOnly', 'file' => 'isUriWithSchemeHostAndPathOnly', 'ftp' => 'isNonEmptyHostUriWithoutFragmentAndQuery', 'gopher' => 'isNonEmptyHostUriWithoutFragmentAndQuery', 'http' => 'isNonEmptyHostUri', 'https' => 'isNonEmptyHostUri', 'ws' => 'isNonEmptyHostUriWithoutFragment', 'wss' => 'isNonEmptyHostUriWithoutFragment']
 - URI validation methods per scheme.
 - $authority : string|null
 - $fragment : string|null
 - $host : string|null
 - $path : string
 - $port : int|null
 - $query : string|null
 - $scheme : string|null
 - $uri : string|null
 - $user_info : string|null
 - __debugInfo() : array{scheme: ?string, user_info: ?string, host: ?string, port: ?int, path: string, query: ?string, fragment: ?string}
 - {@inheritDoc}
 - __set_state() : self
 - {@inheritDoc}
 - __toString() : string
 - Returns the string representation as a URI reference.
 - createFromBaseUri() : UriInterface
 - Create a new instance from a URI and a Base URI.
 - createFromComponents() : self
 - Create a new instance from a hash representation of the URI similar to PHP parse_url function result.
 - createFromDataPath() : self
 - Create a new instance from a data file path.
 - createFromServer() : self
 - Create a new instance from the environment.
 - createFromString() : self
 - Create a new instance from a string.
 - createFromUnixPath() : self
 - Create a new instance from a Unix path string.
 - createFromUri() : self
 - Create a new instance from a URI object.
 - createFromWindowsPath() : self
 - Create a new instance from a local Windows path string.
 - getAuthority() : string|null
 - Retrieve the authority component of the URI.
 - getFragment() : string|null
 - Retrieve the fragment component of the URI.
 - getHost() : string|null
 - Retrieve the host component of the URI.
 - getPath() : string
 - Retrieve the path component of the URI.
 - getPort() : int|null
 - Retrieve the port component of the URI.
 - getQuery() : string|null
 - Retrieve the query string of the URI.
 - getScheme() : string|null
 - Retrieve the scheme component of the URI.
 - getUserInfo() : string|null
 - Retrieve the user information component of the URI.
 - jsonSerialize() : string
 - Returns the string representation as a URI reference.
 - toString() : string
 - withFragment() : UriInterface
 - Return an instance with the specified URI fragment.
 - withHost() : UriInterface
 - Return an instance with the specified host.
 - withPath() : UriInterface
 - Return an instance with the specified path.
 - withPort() : UriInterface
 - Return an instance with the specified port.
 - withQuery() : UriInterface
 - Return an instance with the specified query string.
 - withScheme() : UriInterface
 - Return an instance with the specified scheme.
 - withUserInfo() : UriInterface
 - Return an instance with the specified user information.
 - __construct() : mixed
 - assertValidPath() : void
 - Assert the path is a compliant with RFC2397.
 - assertValidState() : void
 - assert the URI internal state is valid.
 - fetchHostname() : array{0: string|null, 1: int|null}
 - Returns the environment host.
 - fetchRequestUri() : array{0: ?string, 1: ?string}
 - Returns the environment path.
 - fetchScheme() : string
 - Returns the environment scheme.
 - fetchUserInfo() : array{0: ?string, 1: ?string}
 - Returns the environment user info.
 - filterString() : string|null
 - Filter a string.
 - formatDataPath() : string
 - Filter the Path component.
 - formatFilePath() : string
 - Format path component for file scheme.
 - formatHost() : string|null
 - Validate and Format the Host component.
 - formatIp() : string
 - Validate and Format the IPv6/IPvfuture host.
 - formatPath() : string
 - Format the Path component.
 - formatPort() : int|null
 - Format the Port component.
 - formatQueryAndFragment() : string|null
 - Format the Query or the Fragment component.
 - formatRegisteredName() : string
 - Validate and format a registered name.
 - formatScheme() : string|null
 - Format the Scheme and Host component.
 - formatUserInfo() : string|null
 - Set the UserInfo component.
 - getUriString() : string
 - Generate the URI string representation from its components.
 - isNonEmptyHostUri() : bool
 - URI validation for URI schemes which disallow the empty '' host.
 - isNonEmptyHostUriWithoutFragment() : bool
 - URI validation for URIs schemes which disallow the empty '' host and forbids the fragment component.
 - isNonEmptyHostUriWithoutFragmentAndQuery() : bool
 - URI validation for URIs schemes which disallow the empty '' host and forbids fragment and query components.
 - isUriWithSchemeAndPathOnly() : bool
 - URI validation for URI schemes which allows only scheme and path components.
 - isUriWithSchemeHostAndPathOnly() : bool
 - URI validation for URI schemes which allows only scheme, host and path components.
 - setAuthority() : string|null
 - Generate the URI authority part.
 - urlEncodeMatch() : string
 - Returns the RFC3986 encoded string matched.
 - validateParameter() : bool
 - Validate mediatype parameter.
 
Constants
ASCII
All ASCII letters sorted by typical frequency of occurrence.
    private
    string
    ASCII
    = " eiasntrolud][cmp'
g|hv.fb,:=-q10C2*yx)(L9AS/P"EjMIk3>5T<D4}B{8FwR67UGN;JzV#HOW_&!K?XQ%Y\	Z+~^$@` 
"
    
    
    
HOST_ADDRESS_BLOCK
Significant 10 bits of IP to detect Zone ID regular expression pattern.
    private
    mixed
    HOST_ADDRESS_BLOCK
    = "��"
    
        
    
REGEXP_BINARY
Base64 content regular expression pattern.
    private
    mixed
    REGEXP_BINARY
    = ',(;|^)base64$,'
    
        
    
    Tags
REGEXP_CHARS_SUBDELIM
RFC3986 Sub delimiter characters regular expression pattern.
    private
    string
    REGEXP_CHARS_SUBDELIM
    = "\!$&'\(\)\*\+,;\=%"
    
    
    
    Tags
REGEXP_CHARS_UNRESERVED
RFC3986 unreserved characters regular expression pattern.
    private
    string
    REGEXP_CHARS_UNRESERVED
    = 'A-Za-z0-9_\-\.~'
    
    
    
    Tags
REGEXP_FILE_PATH
Regular expression pattern to for file URI.
    private
    mixed
    REGEXP_FILE_PATH
    = ',^(?<delim>/)?(?<volume>[a-zA-Z])(?:[:|\|]|%7C)(?<rest>.*)?,'
        | as %7C) by ::formatPath(),
so we account for that here.
REGEXP_HOST_GEN_DELIMS
RFC3986 delimiters of the generic URI components regular expression pattern.
    private
    mixed
    REGEXP_HOST_GEN_DELIMS
    = '/[:\/?#\[\]@ ]/'
    
        
    
    Tags
REGEXP_HOST_IPFUTURE
RFC3986 IPvFuture regular expression pattern.
    private
    mixed
    REGEXP_HOST_IPFUTURE
    = '/^
        v(?<version>[A-F0-9])+\.
        (?:
            (?<unreserved>[a-z0-9_~\-\.])|
            (?<sub_delims>[!$&'()*+,;=:])  # also include the : character
        )+
    $/ix'
    
        
    
    Tags
REGEXP_HOST_PORT
RFC3986 IPvFuture host and port component.
    private
    mixed
    REGEXP_HOST_PORT
    = ',^(?<host>(\[.*]|[^:])*)(:(?<port>[^/?#]*))?$,x'
    
        
    
REGEXP_HOST_REGNAME
RFC3986 host identified by a registered name regular expression pattern.
    private
    mixed
    REGEXP_HOST_REGNAME
    = '/^(
        (?<unreserved>[a-z0-9_~\-\.])|
        (?<sub_delims>[!$&'()*+,;=])|
        (?<encoded>%[A-F0-9]{2})
    )+$/x'
    
        
    
    Tags
REGEXP_INVALID_CHARS
RFC3986 invalid characters.
    private
    string
    REGEXP_INVALID_CHARS
    = '/[\x00-\x1f\x7f]/'
    
    
    
    Tags
REGEXP_MIMETYPE
Mimetype regular expression pattern.
    private
    mixed
    REGEXP_MIMETYPE
    = ',^\w+/[-.\w]+(?:\+[-.\w]+)?$,'
    
        
    
    Tags
REGEXP_SCHEME
RFC3986 schema regular expression pattern.
    private
    mixed
    REGEXP_SCHEME
    = ',^[a-z]([-a-z0-9+.]+)?$,i'
    
        
    
    Tags
REGEXP_WINDOW_PATH
Windows file path string regular expression pattern.
    private
    mixed
    REGEXP_WINDOW_PATH
    = ',^(?<root>[a-zA-Z][:|\|]),'
        SCHEME_DEFAULT_PORT
Supported schemes and corresponding default port.
    private
    array<string, int|null>
    SCHEME_DEFAULT_PORT
    = ['data' => null, 'file' => null, 'ftp' => 21, 'gopher' => 70, 'http' => 80, 'https' => 443, 'ws' => 80, 'wss' => 443]
    
    
    
SCHEME_VALIDATION_METHOD
URI validation methods per scheme.
    private
    array<string|int, string>
    SCHEME_VALIDATION_METHOD
    = ['data' => 'isUriWithSchemeAndPathOnly', 'file' => 'isUriWithSchemeHostAndPathOnly', 'ftp' => 'isNonEmptyHostUriWithoutFragmentAndQuery', 'gopher' => 'isNonEmptyHostUriWithoutFragmentAndQuery', 'http' => 'isNonEmptyHostUri', 'https' => 'isNonEmptyHostUri', 'ws' => 'isNonEmptyHostUriWithoutFragment', 'wss' => 'isNonEmptyHostUriWithoutFragment']
    
    
    
Properties
$authority
    private
        string|null
    $authority
    
        
        
    
$fragment
    private
        string|null
    $fragment
    
        
        
    
$host
    private
        string|null
    $host
    
        
        
    
$path
    private
        string
    $path
     = ''
        
        
    
$port
    private
        int|null
    $port
    
        
        
    
$query
    private
        string|null
    $query
    
        
        
    
$scheme
    private
        string|null
    $scheme
    
        
        
    
$uri
    private
        string|null
    $uri
    
        
        
    
$user_info
    private
        string|null
    $user_info
    
        
        
    
Methods
__debugInfo()
{@inheritDoc}
    public
                __debugInfo() : array{scheme: ?string, user_info: ?string, host: ?string, port: ?int, path: string, query: ?string, fragment: ?string}
    
    
    
        Return values
array{scheme: ?string, user_info: ?string, host: ?string, port: ?int, path: string, query: ?string, fragment: ?string} —__set_state()
{@inheritDoc}
    public
            static    __set_state(array<string|int, mixed> $components) : self
    
        Parameters
- $components : array<string|int, mixed>
 
Return values
self —__toString()
Returns the string representation as a URI reference.
    public
                __toString() : string
    
    
    
        Return values
string —createFromBaseUri()
Create a new instance from a URI and a Base URI.
    public
            static    createFromBaseUri(mixed $uri[, null|mixed $base_uri = null ]) : UriInterface
        The returned URI must be absolute.
Parameters
- $uri : mixed
 - 
                    
the input URI to create
 - $base_uri : null|mixed = null
 - 
                    
the base URI used for reference
 
Return values
UriInterface —createFromComponents()
Create a new instance from a hash representation of the URI similar to PHP parse_url function result.
    public
            static    createFromComponents([array<string|int, mixed> $components = [] ]) : self
    
        Parameters
- $components : array<string|int, mixed> = []
 
Return values
self —createFromDataPath()
Create a new instance from a data file path.
    public
            static    createFromDataPath(string $path[, resource|null $context = null ]) : self
    
        Parameters
- $path : string
 - $context : resource|null = null
 
Tags
Return values
self —createFromServer()
Create a new instance from the environment.
    public
            static    createFromServer(array<string|int, mixed> $server) : self
    
        Parameters
- $server : array<string|int, mixed>
 
Return values
self —createFromString()
Create a new instance from a string.
    public
            static    createFromString([string|mixed $uri = '' ]) : self
    
        Parameters
- $uri : string|mixed = ''
 
Return values
self —createFromUnixPath()
Create a new instance from a Unix path string.
    public
            static    createFromUnixPath([string $uri = '' ]) : self
    
        Parameters
- $uri : string = ''
 
Return values
self —createFromUri()
Create a new instance from a URI object.
    public
            static    createFromUri(UriInterface|UriInterface $uri) : self
    
        Parameters
- $uri : UriInterface|UriInterface
 - 
                    
the input URI to create
 
Return values
self —createFromWindowsPath()
Create a new instance from a local Windows path string.
    public
            static    createFromWindowsPath([string $uri = '' ]) : self
    
        Parameters
- $uri : string = ''
 
Return values
self —getAuthority()
Retrieve the authority component of the URI.
    public
                getAuthority() : string|null
    
    
    
        Return values
string|null —getFragment()
Retrieve the fragment component of the URI.
    public
                getFragment() : string|null
    
    
    
        Return values
string|null —getHost()
Retrieve the host component of the URI.
    public
                getHost() : string|null
    
    
    
        Return values
string|null —getPath()
Retrieve the path component of the URI.
    public
                getPath() : string
    
    
    
        Return values
string —getPort()
Retrieve the port component of the URI.
    public
                getPort() : int|null
    
    
    
        Return values
int|null —getQuery()
Retrieve the query string of the URI.
    public
                getQuery() : string|null
    
    
    
        Return values
string|null —getScheme()
Retrieve the scheme component of the URI.
    public
                getScheme() : string|null
    
    
    
        Return values
string|null —getUserInfo()
Retrieve the user information component of the URI.
    public
                getUserInfo() : string|null
    
    
    
        Return values
string|null —jsonSerialize()
Returns the string representation as a URI reference.
    public
                jsonSerialize() : string
    
    
    
        Return values
string —toString()
    public
                toString() : string
        
    
    
        Return values
string —withFragment()
Return an instance with the specified URI fragment.
    public
                withFragment(mixed $fragment) : UriInterface
    
        Parameters
- $fragment : mixed
 
Return values
UriInterface —withHost()
Return an instance with the specified host.
    public
                withHost(mixed $host) : UriInterface
    
        Parameters
- $host : mixed
 
Return values
UriInterface —withPath()
Return an instance with the specified path.
    public
                withPath(string|object $path) : UriInterface
    
        Parameters
- $path : string|object
 
Return values
UriInterface —withPort()
Return an instance with the specified port.
    public
                withPort(mixed $port) : UriInterface
    
        Parameters
- $port : mixed
 
Return values
UriInterface —withQuery()
Return an instance with the specified query string.
    public
                withQuery(mixed $query) : UriInterface
    
        Parameters
- $query : mixed
 
Return values
UriInterface —withScheme()
Return an instance with the specified scheme.
    public
                withScheme(mixed $scheme) : UriInterface
    
        Parameters
- $scheme : mixed
 
Return values
UriInterface —withUserInfo()
Return an instance with the specified user information.
    public
                withUserInfo(mixed $user[, mixed $password = null ]) : UriInterface
    
        Parameters
- $user : mixed
 - $password : mixed = null
 
Return values
UriInterface —__construct()
    private
                __construct(string|null $scheme, string|null $user, string|null $pass, string|null $host, int|null $port, string $path, string|null $query, string|null $fragment) : mixed
        
        Parameters
- $scheme : string|null
 - $user : string|null
 - $pass : string|null
 - $host : string|null
 - $port : int|null
 - $path : string
 - $query : string|null
 - $fragment : string|null
 
Return values
mixed —assertValidPath()
Assert the path is a compliant with RFC2397.
    private
                assertValidPath(string $mimetype, string $parameters, string $data) : void
    
        Parameters
- $mimetype : string
 - $parameters : string
 - $data : string
 
Tags
Return values
void —assertValidState()
assert the URI internal state is valid.
    private
                assertValidState() : void
    
    
    
    Tags
Return values
void —fetchHostname()
Returns the environment host.
    private
            static    fetchHostname(array<string|int, mixed> $server) : array{0: string|null, 1: int|null}
    
        Parameters
- $server : array<string|int, mixed>
 
Tags
Return values
array{0: string|null, 1: int|null} —fetchRequestUri()
Returns the environment path.
    private
            static    fetchRequestUri(array<string|int, mixed> $server) : array{0: ?string, 1: ?string}
    
        Parameters
- $server : array<string|int, mixed>
 
Return values
array{0: ?string, 1: ?string} —fetchScheme()
Returns the environment scheme.
    private
            static    fetchScheme(array<string|int, mixed> $server) : string
    
        Parameters
- $server : array<string|int, mixed>
 
Return values
string —fetchUserInfo()
Returns the environment user info.
    private
            static    fetchUserInfo(array<string|int, mixed> $server) : array{0: ?string, 1: ?string}
    
        Parameters
- $server : array<string|int, mixed>
 
Return values
array{0: ?string, 1: ?string} —filterString()
Filter a string.
    private
                filterString(mixed $str) : string|null
    
        Parameters
- $str : mixed
 - 
                    
the value to evaluate as a string
 
Tags
Return values
string|null —formatDataPath()
Filter the Path component.
    private
                formatDataPath(string $path) : string
    
        Parameters
- $path : string
 
Tags
Return values
string —formatFilePath()
Format path component for file scheme.
    private
                formatFilePath(string $path) : string
    
        Parameters
- $path : string
 
Return values
string —formatHost()
Validate and Format the Host component.
    private
                formatHost(string|null $host) : string|null
    
        Parameters
- $host : string|null
 
Return values
string|null —formatIp()
Validate and Format the IPv6/IPvfuture host.
    private
                formatIp(string $host) : string
    
        Parameters
- $host : string
 
Tags
Return values
string —formatPath()
Format the Path component.
    private
                formatPath(string $path) : string
    
        Parameters
- $path : string
 
Return values
string —formatPort()
Format the Port component.
    private
                formatPort([object|null|int|string $port = null ]) : int|null
    
        Parameters
- $port : object|null|int|string = null
 
Tags
Return values
int|null —formatQueryAndFragment()
Format the Query or the Fragment component.
    private
                formatQueryAndFragment(string|null $component) : string|null
        Returns a array containing:
- the formatted component (a string or null)
 - a boolean flag telling wether the delimiter is to be added to the component when building the URI string representation
 
Parameters
- $component : string|null
 
Return values
string|null —formatRegisteredName()
Validate and format a registered name.
    private
                formatRegisteredName(string $host) : string
        The host is converted to its ascii representation if needed
Parameters
- $host : string
 
Tags
Return values
string —formatScheme()
Format the Scheme and Host component.
    private
                formatScheme(string|null $scheme) : string|null
    
        Parameters
- $scheme : string|null
 
Tags
Return values
string|null —formatUserInfo()
Set the UserInfo component.
    private
                formatUserInfo(string|null $user, string|null $password) : string|null
    
        Parameters
- $user : string|null
 - $password : string|null
 
Return values
string|null —getUriString()
Generate the URI string representation from its components.
    private
                getUriString(string|null $scheme, string|null $authority, string $path, string|null $query, string|null $fragment) : string
    
        Parameters
- $scheme : string|null
 - $authority : string|null
 - $path : string
 - $query : string|null
 - $fragment : string|null
 
Tags
Return values
string —isNonEmptyHostUri()
URI validation for URI schemes which disallow the empty '' host.
    private
                isNonEmptyHostUri() : bool
    
    
    
        Return values
bool —isNonEmptyHostUriWithoutFragment()
URI validation for URIs schemes which disallow the empty '' host and forbids the fragment component.
    private
                isNonEmptyHostUriWithoutFragment() : bool
    
    
    
        Return values
bool —isNonEmptyHostUriWithoutFragmentAndQuery()
URI validation for URIs schemes which disallow the empty '' host and forbids fragment and query components.
    private
                isNonEmptyHostUriWithoutFragmentAndQuery() : bool
    
    
    
        Return values
bool —isUriWithSchemeAndPathOnly()
URI validation for URI schemes which allows only scheme and path components.
    private
                isUriWithSchemeAndPathOnly() : bool
    
    
    
        Return values
bool —isUriWithSchemeHostAndPathOnly()
URI validation for URI schemes which allows only scheme, host and path components.
    private
                isUriWithSchemeHostAndPathOnly() : bool
    
    
    
        Return values
bool —setAuthority()
Generate the URI authority part.
    private
                setAuthority() : string|null
    
    
    
        Return values
string|null —urlEncodeMatch()
Returns the RFC3986 encoded string matched.
    private
            static    urlEncodeMatch(array<string|int, mixed> $matches) : string
    
        Parameters
- $matches : array<string|int, mixed>
 
Return values
string —validateParameter()
Validate mediatype parameter.
    private
                validateParameter(string $parameter) : bool
    
        Parameters
- $parameter : string