class Url extends Object

URI Syntax (RFC 3986).

scheme  user  password  host  port  basePath   relativeUrl
  |      |      |        |      |    |             |
/--\   /--\ /------\ /-------\ /--\/--\/----------------------------\
http://john:x0y17575@nette.org:8042/en/manual.php?name=param#fragment  <-- absoluteUrl
       \__________________________/\____________/^\________/^\______/
                    |                     |           |         |
                authority               path        query    fragment

Properties

static array $defaultPorts
string $scheme
string $user
string $password
string $host
string $port
string $path
string $query
string $fragment
string read-only $absoluteUrl
string read-only $authority
string read-only $hostUrl
string read-only $basePath
string read-only $baseUrl
string read-only $relativeUrl

Methods

__construct($url = NULL)

No description

Url
setScheme($value)

Sets the scheme part of URI.

string
getScheme()

Returns the scheme part of URI.

Url
setUser($value)

Sets the user name part of URI.

string
getUser()

Returns the user name part of URI.

Url
setPassword($value)

Sets the password part of URI.

string
getPassword()

Returns the password part of URI.

Url
setHost($value)

Sets the host part of URI.

string
getHost()

Returns the host part of URI.

Url
setPort($value)

Sets the port part of URI.

string
getPort()

Returns the port part of URI.

Url
setPath($value)

Sets the path part of URI.

string
getPath()

Returns the path part of URI.

Url
setQuery($value)

Sets the query part of URI.

Url
appendQuery($value)

Appends the query part of URI.

string
getQuery()

Returns the query part of URI.

mixed
getQueryParameter($name, $default = NULL)

No description

Url
setQueryParameter($name, $value)

No description

Url
setFragment($value)

Sets the fragment part of URI.

string
getFragment()

Returns the fragment part of URI.

string
getAbsoluteUrl()

Returns the entire URI including query string and fragment.

string
getAuthority()

Returns the [user[:pass]@]host[:port] part of URI.

string
getHostUrl()

Returns the scheme and authority part of URI.

string
getBasePath()

Returns the base-path.

string
getBaseUrl()

Returns the base-URI.

string
getRelativeUrl()

Returns the relative-URI.

bool
isEqual($url)

URL comparison.

Url
canonicalize()

Transforms URL to canonical form.

string
__toString()

No description

static string
unescape($s, $reserved = '%;/?:@&=+$,')

Similar to rawurldecode, but preserves reserved chars encoded.

Details

at line 89
__construct($url = NULL)

No description

Parameters

$url

Exceptions

InvalidArgumentException

at line 122
Url setScheme($value)

Sets the scheme part of URI.

Parameters

$value

Return Value

Url

at line 133
string getScheme()

Returns the scheme part of URI.

Return Value

string

at line 144
Url setUser($value)

Sets the user name part of URI.

Parameters

$value

Return Value

Url

at line 155
string getUser()

Returns the user name part of URI.

Return Value

string

at line 166
Url setPassword($value)

Sets the password part of URI.

Parameters

$value

Return Value

Url

at line 177
string getPassword()

Returns the password part of URI.

Return Value

string

at line 188
Url setHost($value)

Sets the host part of URI.

Parameters

$value

Return Value

Url

at line 199
string getHost()

Returns the host part of URI.

Return Value

string

at line 210
Url setPort($value)

Sets the port part of URI.

Parameters

$value

Return Value

Url

at line 221
string getPort()

Returns the port part of URI.

Return Value

string

at line 232
Url setPath($value)

Sets the path part of URI.

Parameters

$value

Return Value

Url

at line 243
string getPath()

Returns the path part of URI.

Return Value

string

at line 254
Url setQuery($value)

Sets the query part of URI.

Parameters

$value

Return Value

Url

at line 266
Url appendQuery($value)

Appends the query part of URI.

Parameters

$value

Return Value

Url

at line 278
string getQuery()

Returns the query part of URI.

Return Value

string

at line 289
mixed getQueryParameter($name, $default = NULL)

No description

Parameters

$name
$default

Return Value

mixed

at line 301
Url setQueryParameter($name, $value)

No description

Parameters

$name
$value

Return Value

Url

at line 319
Url setFragment($value)

Sets the fragment part of URI.

Parameters

$value

Return Value

Url

at line 330
string getFragment()

Returns the fragment part of URI.

Return Value

string

at line 340
string getAbsoluteUrl()

Returns the entire URI including query string and fragment.

Return Value

string

at line 352
string getAuthority()

Returns the [user[:pass]@]host[:port] part of URI.

Return Value

string

at line 371
string getHostUrl()

Returns the scheme and authority part of URI.

Return Value

string

at line 381
string getBasePath()

Returns the base-path.

Return Value

string

at line 392
string getBaseUrl()

Returns the base-URI.

Return Value

string

at line 402
string getRelativeUrl()

Returns the relative-URI.

Return Value

string

at line 413
bool isEqual($url)

URL comparison.

Parameters

$url

Return Value

bool

at line 436
Url canonicalize()

Transforms URL to canonical form.

Return Value

Url

at line 448
string __toString()

No description

Return Value

string

at line 460
static string unescape($s, $reserved = '%;/?:@&=+$,')

Similar to rawurldecode, but preserves reserved chars encoded.

Parameters

$s
$reserved

Return Value

string