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
int $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
array read-only $queryParameters

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.

int
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.

array
getQueryParameters()

No description

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.

static array
parseQuery($s)

Parses query string.

Details

at line 88
__construct($url = NULL)

No description

Parameters

$url

Exceptions

InvalidArgumentException

at line 118
Url setScheme($value)

Sets the scheme part of URI.

Parameters

$value

Return Value

Url

at line 129
string getScheme()

Returns the scheme part of URI.

Return Value

string

at line 140
Url setUser($value)

Sets the user name part of URI.

Parameters

$value

Return Value

Url

at line 151
string getUser()

Returns the user name part of URI.

Return Value

string

at line 162
Url setPassword($value)

Sets the password part of URI.

Parameters

$value

Return Value

Url

at line 173
string getPassword()

Returns the password part of URI.

Return Value

string

at line 184
Url setHost($value)

Sets the host part of URI.

Parameters

$value

Return Value

Url

at line 196
string getHost()

Returns the host part of URI.

Return Value

string

at line 207
Url setPort($value)

Sets the port part of URI.

Parameters

$value

Return Value

Url

at line 218
int getPort()

Returns the port part of URI.

Return Value

int

at line 231
Url setPath($value)

Sets the path part of URI.

Parameters

$value

Return Value

Url

at line 245
string getPath()

Returns the path part of URI.

Return Value

string

at line 256
Url setQuery($value)

Sets the query part of URI.

Parameters

$value

Return Value

Url

at line 268
Url appendQuery($value)

Appends the query part of URI.

Parameters

$value

Return Value

Url

at line 281
string getQuery()

Returns the query part of URI.

Return Value

string

at line 293
array getQueryParameters()

No description

Return Value

array

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

No description

Parameters

$name
$default

Return Value

mixed

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

No description

Parameters

$name
$value

Return Value

Url

at line 327
Url setFragment($value)

Sets the fragment part of URI.

Parameters

$value

Return Value

Url

at line 338
string getFragment()

Returns the fragment part of URI.

Return Value

string

at line 348
string getAbsoluteUrl()

Returns the entire URI including query string and fragment.

Return Value

string

at line 360
string getAuthority()

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

Return Value

string

at line 378
string getHostUrl()

Returns the scheme and authority part of URI.

Return Value

string

at line 388
string getBasePath()

Returns the base-path.

Return Value

string

at line 399
string getBaseUrl()

Returns the base-URI.

Return Value

string

at line 409
string getRelativeUrl()

Returns the relative-URI.

Return Value

string

at line 420
bool isEqual($url)

URL comparison.

Parameters

$url

Return Value

bool

at line 443
Url canonicalize()

Transforms URL to canonical form.

Return Value

Url

at line 458
string __toString()

No description

Return Value

string

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

Similar to rawurldecode, but preserves reserved chars encoded.

Parameters

$s
$reserved

Return Value

string

at line 490
static array parseQuery($s)

Parses query string.

Parameters

$s

Return Value

array