class UrlImmutable implements JsonSerializable

Immutable representation of a URL.

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

Traits

Strict class for better experience.

Methods

__construct(string|UrlImmutable|Url $url)

No description

withScheme(string $scheme)

No description

string
getScheme()

No description

withUser(string $user)

No description

string
getUser()

No description

withPassword(string $password)

No description

string
getPassword()

No description

withHost(string $host)

No description

string
getHost()

No description

string
getDomain(int $level = 2)

No description

withPort(int $port)

No description

int|null
getPort()

No description

withPath(string $path)

No description

string
getPath()

No description

withQuery(string|array $query)

No description

string
getQuery()

No description

array
getQueryParameters()

No description

array|string|null
getQueryParameter(string $name)

No description

withFragment(string $fragment)

No description

string
getFragment()

No description

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
__toString()

No description

bool
isEqual(string|Url|UrlImmutable $url)

No description

string
jsonSerialize()

No description

array
export()

No description

void
build()

No description

Details

at line 77
__construct(string|UrlImmutable|Url $url)

Parameters

string|UrlImmutable|Url $url

Exceptions

InvalidArgumentException if URL is malformed

at line 93
UrlImmutable withScheme(string $scheme)

Parameters

string $scheme

Return Value

UrlImmutable

at line 102
string getScheme()

Return Value

string

at line 111
UrlImmutable withUser(string $user)

Parameters

string $user

Return Value

UrlImmutable

at line 120
string getUser()

Return Value

string

at line 129
UrlImmutable withPassword(string $password)

Parameters

string $password

Return Value

UrlImmutable

at line 138
string getPassword()

Return Value

string

at line 147
UrlImmutable withHost(string $host)

Parameters

string $host

Return Value

UrlImmutable

at line 156
string getHost()

Return Value

string

at line 162
string getDomain(int $level = 2)

Parameters

int $level

Return Value

string

at line 173
UrlImmutable withPort(int $port)

Parameters

int $port

Return Value

UrlImmutable

at line 182
int|null getPort()

Return Value

int|null

at line 191
UrlImmutable withPath(string $path)

Parameters

string $path

Return Value

UrlImmutable

at line 200
string getPath()

Return Value

string

at line 210
UrlImmutable withQuery(string|array $query)

Parameters

string|array $query

Return Value

UrlImmutable

at line 219
string getQuery()

Return Value

string

at line 225
array getQueryParameters()

Return Value

array

at line 234
array|string|null getQueryParameter(string $name)

Parameters

string $name

Return Value

array|string|null

at line 243
UrlImmutable withFragment(string $fragment)

Parameters

string $fragment

Return Value

UrlImmutable

at line 252
string getFragment()

Return Value

string

at line 261
string getAbsoluteUrl()

Returns the entire URI including query string and fragment.

Return Value

string

at line 272
string getAuthority()

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

Return Value

string

at line 281
string getHostUrl()

Returns the scheme and authority part of URI.

Return Value

string

at line 288
string __toString()

Return Value

string

at line 297
bool isEqual(string|Url|UrlImmutable $url)

Parameters

string|Url|UrlImmutable $url

Return Value

bool

at line 303
string jsonSerialize()

Return Value

string

at line 310
final array export()

Return Value

array

at line 316
protected void build()

Return Value

void