UriInterface

Uri Interface

Interface for read-only access to Uris.

since

1.0

Methods

__toString

Magic method to get the string representation of the URI object.

__toString() : string
since

1.0

Response

string

getFragment

Get the URI archor string Everything after the "#".

getFragment() : string
since

1.0

Response

stringThe URI anchor string.

getHost

Get URI host Returns the hostname/ip or null if no hostname/ip was specified.

getHost() : string
since

1.0

Response

stringThe URI host.

getPass

Get URI password Returns the password, or null if no password was specified.

getPass() : string
since

1.0

Response

stringThe URI password.

getPath

Gets the URI path string.

getPath() : string
since

1.0

Response

stringThe URI path string.

getPort

Get URI port Returns the port number, or null if no port was specified.

getPort() : integer
since

1.0

Response

integerThe URI port number.

getQuery

Returns flat query string.

getQuery(boolean $toArray = false) : string
since

1.0

Arguments

$toArray

booleanTrue to return the query as a key => value pair array.

Response

stringQuery string.

getScheme

Get URI scheme (protocol) ie. http, https, ftp, etc.

getScheme() : string

..

since

1.0

Response

stringThe URI scheme.

getUser

Get URI username Returns the username, or null if no username was specified.

getUser() : string
since

1.0

Response

stringThe URI username.

getVar

Returns a query variable by name.

getVar(string $name, string $default = null) : array
since

1.0

Arguments

$name

stringName of the query variable to get.

$default

stringDefault value to return if the variable is not set.

Response

arrayQuery variables.

hasVar

Checks if variable exists.

hasVar(string $name) : boolean
since

1.0

Arguments

$name

stringName of the query variable to check.

Response

booleanTrue if the variable exists.

isSsl

Checks whether the current URI is using HTTPS.

isSsl() : boolean
since

1.0

Response

booleanTrue if using SSL via HTTPS.

toString

Returns full uri string.

toString(array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')) : string
since

1.0

Arguments

$parts

arrayAn array of strings specifying the parts to render.

Response

stringThe rendered URI string.

Constants

SCHEME

Include the scheme (http, https, etc.)

Value 1
since

1.2.0

Type(s)

integer

USER

Include the user

Value 2
since

1.2.0

Type(s)

integer

PASS

Include the password

Value 4
since

1.2.0

Type(s)

integer

HOST

Include the host

Value 8
since

1.2.0

Type(s)

integer

PORT

Include the port

Value 16
since

1.2.0

Type(s)

integer

PATH

Include the path

Value 32
since

1.2.0

Type(s)

integer

QUERY

Include the query string

Value 64
since

1.2.0

Type(s)

integer

FRAGMENT

Include the fragment

Value 128
since

1.2.0

Type(s)

integer

ALL

Include all available url parts (scheme, user, pass, host, port, path, query, fragment)

Value 255
since

1.2.0

Type(s)

integer