Uri
    
            
            in package
            
        
    
            
            implements
                            JsonSerializable,                             Stringable,                             UriInterface                    
    
    
Net\Uri class.
Table of Contents
Interfaces
- JsonSerializable
- Stringable
- UriInterface
- Value object representing a URI.
Constants
- ABSOLUTE_PATH = 2
- IDN_DECODE = 32
- IDN_ENCODE = 16
- IDNA = 8
- NORMALIZE_PATH = 4
- REQUIRE_PORT = 1
- RE_AUTH = '!^(?P<userinfoc>(?P<user>[^:/?#]+)(?P<passc>:(?P<pass>[^:/?#]+))?@)?' . '(?P<host>[^:/?#]*|\[[^/?#]*\])(?P<portc>:(?P<port>[0-9]*))?$!'
- RE_MAIN = '!^(?P<schemec>(?P<scheme>[^:/?#]+):)?(?P<authorityc>//(?P<authority>[^/?#]*))?' . '(?P<path>[^?#]*)(?P<queryc>\?(?P<query>[^#]*))?(?P<fragmentc>#(?P<fragment>.*))?$!'
Properties
- $authority : bool
- $fragment : string
- $host : string
- $pass : string|null
- $path : string
- $port : int|null
- $port_defaults : array<string|int, mixed>
- $query : string
- $scheme : string
- $user : string
Methods
- __construct() : mixed
- Create new URI instance using a string
- __toString() : string
- Return the string representation as a URI reference.
- getAuthority() : string
- Retrieve the authority component of the URI.
- getComponents() : array<string|int, mixed>
- Get compontsns as array; as parse_url() method
- getFragment() : string
- Retrieve the fragment component of the URI.
- getHost() : string
- Retrieve the host component of the URI.
- getPath() : string
- Retrieve the path component of the URI.
- getPort() : null|int
- Retrieve the port component of the URI.
- getQuery() : string
- Retrieve the query string of the URI.
- getQueryItem() : array<string|int, mixed>|string|null
- Return query item value for named query item, or null if not present.
- getQueryItems() : array<string|int, mixed>
- Return all query items (if any) as associative array.
- getScheme() : string
- Retrieve the scheme component of the URI.
- getUserInfo() : string
- Retrieve the user information component of the URI.
- jsonSerialize() : string
- Return JSON encode value as URI reference.
- toString() : string
- Return the string representation as a URI reference.
- withComponents() : static
- Return an instance with the specified compontents set.
- withFragment() : static
- Return an instance with the specified URI fragment.
- withHost() : static
- Return an instance with the specified host.
- withPath() : static
- Return an instance with the specified path.
- withPort() : static
- Return an instance with the specified port.
- withQuery() : static
- Return an instance with the specified query string.
- withQueryItem() : static
- Add query item value for named query item
- withQueryItems() : static
- Add query items as associative array that will be merged qith current items.
- withScheme() : static
- Return an instance with the specified scheme.
- withUserInfo() : static
- Return an instance with the specified user information.
- setFragment() : void
- setHost() : void
- setPassword() : void
- setPath() : void
- setPort() : void
- setQuery() : void
- setScheme() : void
- setUser() : void
- setUserInfo() : void
- clone() : self
- formatComponent() : string
- idnDecode() : string
- idnEncode() : string
- normalizePath() : string
- parse() : void
- queryMerge() : array<string|int, mixed>
- uriEncode() : string
Constants
ABSOLUTE_PATH
    public
        mixed
    ABSOLUTE_PATH
    = 2
    
    
    
IDN_DECODE
    public
        mixed
    IDN_DECODE
    = 32
    
    
    
IDN_ENCODE
    public
        mixed
    IDN_ENCODE
    = 16
    
    
    
IDNA
    public
        mixed
    IDNA
    = 8
    
    
    
NORMALIZE_PATH
    public
        mixed
    NORMALIZE_PATH
    = 4
    
    
    
REQUIRE_PORT
    public
        mixed
    REQUIRE_PORT
    = 1
    
    
    
RE_AUTH
    private
        mixed
    RE_AUTH
    = '!^(?P<userinfoc>(?P<user>[^:/?#]+)(?P<passc>:(?P<pass>[^:/?#]+))?@)?' . '(?P<host>[^:/?#]*|\[[^/?#]*\])(?P<portc>:(?P<port>[0-9]*))?$!'
    
    
    
RE_MAIN
    private
        mixed
    RE_MAIN
    = '!^(?P<schemec>(?P<scheme>[^:/?#]+):)?(?P<authorityc>//(?P<authority>[^/?#]*))?' . '(?P<path>[^?#]*)(?P<queryc>\?(?P<query>[^#]*))?(?P<fragmentc>#(?P<fragment>.*))?$!'
    
    
    
Properties
$authority
    private
        bool
    $authority
     = false
    
    
    
$fragment
    private
        string
    $fragment
     = ''
    
    
    
$host
    private
        string
    $host
     = ''
    
    
    
$pass
    private
        string|null
    $pass
     = null
    
    
    
$path
    private
        string
    $path
     = ''
    
    
    
$port
    private
        int|null
    $port
     = null
    
    
    
$port_defaults
    private
    static    array<string|int, mixed>
    $port_defaults
     = ['acap' => 674, 'afp' => 548, 'dict' => 2628, 'dns' => 53, 'ftp' => 21, 'git' => 9418, 'gopher' => 70, 'http' => 80, 'https' => 443, 'imap' => 143, 'ipp' => 631, 'ipps' => 631, 'irc' => 194, 'ircs' => 6697, 'ldap' => 389, 'ldaps' => 636, 'mms' => 1755, 'msrp' => 2855, 'mtqp' => 1038, 'nfs' => 111, 'nntp' => 119, 'nntps' => 563, 'pop' => 110, 'prospero' => 1525, 'redis' => 6379, 'rsync' => 873, 'rtsp' => 554, 'rtsps' => 322, 'rtspu' => 5005, 'sftp' => 22, 'smb' => 445, 'snmp' => 161, 'ssh' => 22, 'svn' => 3690, 'telnet' => 23, 'ventrilo' => 3784, 'vnc' => 5900, 'wais' => 210, 'ws' => 80, 'wss' => 443]
    
    
    
$query
    private
        string
    $query
     = ''
    
    
    
$scheme
    private
        string
    $scheme
     = ''
    
    
    
$user
    private
        string
    $user
     = ''
    
    
    
Methods
__construct()
Create new URI instance using a string
    public
                    __construct([string $uri_string = '' ]) : mixed
    Parameters
- $uri_string : string = ''
- 
                    URI as string 
Tags
__toString()
Return the string representation as a URI reference.
    public
                    __toString() : string
    Return values
stringgetAuthority()
Retrieve the authority component of the URI.
    public
                    getAuthority([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI authority, in "[user-info@]host[:port]" format
getComponents()
Get compontsns as array; as parse_url() method
    public
                    getComponents([int $flags = 0 ]) : array<string|int, mixed>
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
array<string|int, mixed>getFragment()
Retrieve the fragment component of the URI.
    public
                    getFragment([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI fragment
getHost()
Retrieve the host component of the URI.
    public
                    getHost([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI host
getPath()
Retrieve the path component of the URI.
    public
                    getPath([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI path
getPort()
Retrieve the port component of the URI.
    public
                    getPort([int $flags = 0 ]) : null|int
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
null|int —The URI port
getQuery()
Retrieve the query string of the URI.
    public
                    getQuery([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI query string
getQueryItem()
Return query item value for named query item, or null if not present.
    public
                    getQueryItem(string $name[, int $flags = 0 ]) : array<string|int, mixed>|string|null
    Parameters
- $name : string
- 
                    Name of query item to retrieve 
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
array<string|int, mixed>|string|null —Query item value
getQueryItems()
Return all query items (if any) as associative array.
    public
                    getQueryItems([int $flags = 0 ]) : array<string|int, mixed>
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
array<string|int, mixed> —Query items
getScheme()
Retrieve the scheme component of the URI.
    public
                    getScheme([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI scheme
getUserInfo()
Retrieve the user information component of the URI.
    public
                    getUserInfo([int $flags = 0 ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
string —The URI user information, in "username[:password]" format
jsonSerialize()
Return JSON encode value as URI reference.
    public
                    jsonSerialize() : string
    Return values
stringtoString()
Return the string representation as a URI reference.
    public
                    toString([int $flags = 0 ][, tring $format = '{scheme}{authority}{path}{query}{fragment}' ]) : string
    Parameters
- $flags : int = 0
- 
                    Optional modifier flags 
- $format : tring = '{scheme}{authority}{path}{query}{fragment}'
- 
                    Optional format specification 
Return values
stringwithComponents()
Return an instance with the specified compontents set.
    public
                    withComponents(array<string|int, mixed> $components[, int $flags = 0 ]) : static
    Parameters
- $components : array<string|int, mixed>
- $flags : int = 0
Return values
static —A new instance with the specified components
withFragment()
Return an instance with the specified URI fragment.
    public
                    withFragment(string $fragment[, int $flags = 0 ]) : static
    Parameters
- $fragment : string
- 
                    The fragment to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
static —A new instance with the specified fragment
withHost()
Return an instance with the specified host.
    public
                    withHost(string $host[, int $flags = 0 ]) : static
    Parameters
- $host : string
- 
                    The hostname to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Tags
Return values
static —A new instance with the specified host
withPath()
Return an instance with the specified path.
    public
                    withPath(string $path[, int $flags = 0 ]) : static
    Parameters
- $path : string
- 
                    The path to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Tags
Return values
static —A new instance with the specified path
withPort()
Return an instance with the specified port.
    public
                    withPort(null|int $port[, int $flags = 0 ]) : static
    Parameters
- $port : null|int
- 
                    The port to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Tags
Return values
static —A new instance with the specified port
withQuery()
Return an instance with the specified query string.
    public
                    withQuery(string $query[, int $flags = 0 ]) : static
    Parameters
- $query : string
- 
                    The query string to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Tags
Return values
static —A new instance with the specified query string
withQueryItem()
Add query item value for named query item
    public
                    withQueryItem(string $name, array<string|int, mixed>|string|null $value[, int $flags = 0 ]) : static
    Parameters
- $name : string
- 
                    Name of query item to add 
- $value : array<string|int, mixed>|string|null
- 
                    Value of query item to add 
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
static —A new instance with the added query items
withQueryItems()
Add query items as associative array that will be merged qith current items.
    public
                    withQueryItems(array<string|int, mixed> $items[, int $flags = 0 ]) : static
    Parameters
- $items : array<string|int, mixed>
- 
                    Array of query items to add 
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
static —A new instance with the added query items
withScheme()
Return an instance with the specified scheme.
    public
                    withScheme(string $scheme[, int $flags = 0 ]) : static
    Parameters
- $scheme : string
- 
                    The scheme to use with the new instance 
- $flags : int = 0
- 
                    Optional modifier flags 
Tags
Return values
static —A new instance with the specified scheme
withUserInfo()
Return an instance with the specified user information.
    public
                    withUserInfo(string $user[, null|string $password = null ][, int $flags = 0 ]) : static
    Parameters
- $user : string
- 
                    The user name to use for authority 
- $password : null|string = null
- 
                    The password associated with $user 
- $flags : int = 0
- 
                    Optional modifier flags 
Return values
static —A new instance with the specified user information
setFragment()
    protected
                    setFragment(string $fragment[, int $flags = 0 ]) : void
    Parameters
- $fragment : string
- $flags : int = 0
setHost()
    protected
                    setHost(string $host[, int $flags = 0 ]) : void
    Parameters
- $host : string
- $flags : int = 0
setPassword()
    protected
                    setPassword(string|null $pass[, int $flags = 0 ]) : void
    Parameters
- $pass : string|null
- $flags : int = 0
setPath()
    protected
                    setPath(string $path[, int $flags = 0 ]) : void
    Parameters
- $path : string
- $flags : int = 0
setPort()
    protected
                    setPort(int|null $port[, int $flags = 0 ]) : void
    Parameters
- $port : int|null
- $flags : int = 0
setQuery()
    protected
                    setQuery(string $query[, int $flags = 0 ]) : void
    Parameters
- $query : string
- $flags : int = 0
setScheme()
    protected
                    setScheme(string $scheme[, int $flags = 0 ]) : void
    Parameters
- $scheme : string
- $flags : int = 0
setUser()
    protected
                    setUser(string $user[, int $flags = 0 ]) : void
    Parameters
- $user : string
- $flags : int = 0
setUserInfo()
    protected
                    setUserInfo([string $user = '' ][, string|null $pass = null ][, int $flags = 0 ]) : void
    Parameters
- $user : string = ''
- $pass : string|null = null
- $flags : int = 0
clone()
    private
                    clone([int $flags = 0 ]) : self
    Parameters
- $flags : int = 0
Return values
selfformatComponent()
    private
                    formatComponent(string|int|null $value[, string $before = '' ][, string $after = '' ]) : string
    Parameters
- $value : string|int|null
- $before : string = ''
- $after : string = ''
Return values
stringidnDecode()
    private
                    idnDecode(string $value) : string
    Parameters
- $value : string
Return values
stringidnEncode()
    private
                    idnEncode(string $value) : string
    Parameters
- $value : string
Return values
stringnormalizePath()
    private
                    normalizePath(string $path) : string
    Parameters
- $path : string
Return values
stringparse()
    private
                    parse([string $uri_string = '' ]) : void
    Parameters
- $uri_string : string = ''
queryMerge()
    private
                    queryMerge(array<string|int, mixed> $a, array<string|int, mixed> $b) : array<string|int, mixed>
    Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>
Return values
array<string|int, mixed>uriEncode()
    private
                    uriEncode(string $source[, int $flags = 0 ][, string $keep = '' ]) : string
    Parameters
- $source : string
- $flags : int = 0
- $keep : string = ''