Constants

RELATIVE_TO_NONE

RELATIVE_TO_NONE

RELATIVE_TO_SCHEME

RELATIVE_TO_SCHEME

RELATIVE_TO_HOST

RELATIVE_TO_HOST

Properties

$salt

$salt : 

Type

$_url

$_url : 

Type

Methods

__construct()

__construct(string  $url) 

Provide the class with an absolute URL. Relative URLs have not been tested, and probably does not work yet.

Parameters

string $url

An absolute URL

sign()

sign(string  $key, string  $paramName = 'sign', string  $algorithm = 'sha1') : $this

Sign the URL using an arbitrary key that must be shared among those that will be able to sign urls.

Parameters

string $key

The key to use for signing the URL

string $paramName

The optional parameter name to use for signing the url. Default is 'sign'

string $algorithm

Alternative algorithm to use, will use sha1 if unspecified.

Returns

$this

quickSign()

quickSign() : $this

Sign the provided URL. Remember to set Url::$salt before using.

Returns

$this

quickCheck()

quickCheck() : $this

Check that the current URL is signed using quickSign(). Remember to set Url::$salt before using.

Returns

$this

isSigned()

isSigned(string  $key, string  $paramName = 'sign', string  $algorithm = 'sha1') : boolean

Check that the URL is signed using the specified key. Look at the comment for static::sign()

Parameters

string $key

The key to use for signing the URL

string $paramName

The optional parameter name to use for signing the url. Default is 'sign'

string $algorithm

Alternative algorithm to use, will use sha1 if unspecified.

Returns

boolean

parse_str()

parse_str(  $str,   $query) 

An implementation of parse_str that takes into account magic quotes.

Parameters

$str
$query

setFragment()

setFragment(mixed  $value) : \Fubber\@this

Set the fragment part of the query (after the #)

Parameters

mixed $value

A string or an array to insert as fragment.

Returns

\Fubber\@this

unsetFragment()

unsetFragment() : $this

Remove the fragment part of the query (after the #). This removes the entire fragment.

Returns

$this

getFragment()

getFragment() : mixed

Get the url fragment.

Returns

mixed

setQuery()

setQuery(string|array  $value) : $this

Set the entire query (from the ? until the fragment #)

Parameters

string|array $value

A string or an array to insert as fragment.

Returns

$this

getQuery()

getQuery() : string

Get the entire query part of the url (from the ? until the fragment #)

Returns

string

setParam()

setParam(string  $param, string|array  $value) : $this

Add or replace a part of the query string

Parameters

string $param

The name of the parameter to change

string|array $value

A string or an array to insert as value.

Returns

$this

unsetParam()

unsetParam(string  $param) : $this

Remove a parameter from the query string

Parameters

string $param

The name of the parameter to remove

Returns

$this

clearParams()

clearParams() : $this

Removes all parameters from the query string

Returns

$this

removeParam()

removeParam(string  $param) : $this

Alias of unsetParam

Parameters

string $param

Returns

$this

setHost()

setHost(mixed  $value) : $this

Set the hostname of the url

Parameters

mixed $value

A string or an array to insert as value.

Returns

$this

getHost()

getHost() : mixed

Get the hostname of the url

Returns

mixed

getUser()

getUser() : mixed

Get the user of the url

Returns

mixed

getPassword()

getPassword() : mixed

Get the password of the url

Returns

mixed

setScheme()

setScheme(string  $value) : $this

Set the scheme of the url (http/https/rtmp etc)

Parameters

string $value

Returns

$this

setPath()

setPath(string  $value) : $this

Set the path of the url

Parameters

string $value

A string to insert as value.

Returns

$this

getPath()

getPath() : string

Returns the path section of the URL up until the query parameter and fragment

Returns

string

parent()

parent() : $this

Navigate up one folder. Unsets all query params and fragment.

Returns

$this

root()

root() : $this

Navigate to root path. Unsets all query params and fragment.

Returns

$this

getParam()

getParam(string  $param) : mixed

Parse out the value from the query string and return it.

Parameters

string $param

The name of the parameter to remove

Returns

mixed

getRelativeTo()

getRelativeTo(string|\Fubber\Url  $relativeTo = self::RELATIVE_TO_NONE) 

Get the url relative to another url or two predefined formats.

Parameters

string|\Fubber\Url $relativeTo

The url that the resulting string is going to be relative to

__toString()

__toString() 

When echoing this class, the URL will be displayed.

current()

current() : \Fubber\Url

Return the URL for the current page, optionally add request parameters

Returns

\Fubber\Url —

Absolute URL

https()

https() : boolean

Returns true if this request was performed with https

Returns

boolean

buildUrl()

buildUrl(array  $parsed) : string

Builds a complete URL from a parsed URL, according to parse_url().

Parameters

array $parsed

Returns

string