Sledgehammer Framework

Url extends Base
in package

Utility class for generating and manipulating urls.

Table of Contents

$fragment  : string
The #hash.
$host  : string
The hostname/ip.
$pass  : string
The password.
$path  : string
The (unescaped) path.
$port  : int
Portnumber.
$query  : array<string|int, mixed>
The parameters in the querystring.
$scheme  : string
The protocol/schema.
$user  : string
The username.
$current  : Url
The url of the current page.
__call()  : mixed
Report that the $method doesn't exist.
__callStatic()  : mixed
Report that the $method doesn't exist.
__construct()  : mixed
Constructor.
__get()  : mixed
Report that $property doesn't exist.
__set()  : mixed
Report that $property doesn't exist and set the property to the given $value.
__toString()  : string
Generate the url as a string.
fragment()  : Url
Return new Url with different .
getCurrentURL()  : Url
Gets the current url based on the information in the $_SERVER array.
getFilename()  : string
Get de filename (or "index.html" if no filename is given.).
getFolders()  : array<string|int, mixed>
Get folders in a array (based on the path).
host()  : Url
Return new Url with different hostname.
parameter()  : Url
Return new Url with modified parameters.
path()  : Url
Return new Url with different path.
port()  : Url
Return new Url with different port.
query()  : mixed
Return new Url with modified paramaters.
removeParameter()  : Url
Return new Url without the given parameter.
scheme()  : Url
Return new Url with different protocol.
setCurrentURL()  : mixed
Set the current url (Mock a request).

Properties

$fragment

The #hash.

public string $fragment

$host

The hostname/ip.

public string $host

$pass

The password.

public string $pass

$path

The (unescaped) path.

public string $path

$port

Portnumber.

public int $port

$query

The parameters in the querystring.

public array<string|int, mixed> $query = []

$scheme

The protocol/schema.

public string $scheme

$user

The username.

public string $user

$current

The url of the current page.

private static Url $current

Methods

__call()

Report that the $method doesn't exist.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__callStatic()

Report that the $method doesn't exist.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

Constructor.

public __construct(string $url) : mixed
Parameters
$url : string

De url om te parsen

Return values
mixed

__get()

Report that $property doesn't exist.

public __get(string $property) : mixed
Parameters
$property : string
Return values
mixed

__set()

Report that $property doesn't exist and set the property to the given $value.

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Return values
mixed

__toString()

Generate the url as a string.

public __toString() : string

Allows URL object to be used as php strings.

Return values
string

fragment()

Return new Url with different .

public fragment(string $value) : Url
Parameters
$value : string
Return values
Url

getCurrentURL()

Gets the current url based on the information in the $_SERVER array.

public static getCurrentURL() : Url
Return values
Url

getFilename()

Get de filename (or "index.html" if no filename is given.).

public getFilename() : string
Return values
string

getFolders()

Get folders in a array (based on the path).

public getFolders() : array<string|int, mixed>
Return values
array<string|int, mixed>

host()

Return new Url with different hostname.

public host(string $hostname) : Url
Parameters
$hostname : string
Return values
Url

parameter()

Return new Url with modified parameters.

public parameter(string $parameter, mixed $value[, mixed $index = false ]) : Url
Parameters
$parameter : string
$value : mixed
$index : mixed = false
Return values
Url

path()

Return new Url with different path.

public path(string $path) : Url
Parameters
$path : string
Return values
Url

port()

Return new Url with different port.

public port(string $number) : Url
Parameters
$number : string
Return values
Url

query()

Return new Url with modified paramaters.

public query(array<string|int, mixed> $parameters[, bool $merge = false ]) : mixed
Parameters
$parameters : array<string|int, mixed>
$merge : bool = false

true: Keep existing parameters, false: overwrite existing query.

Return values
mixed

removeParameter()

Return new Url without the given parameter.

public removeParameter(string $parameter[, mixed $index = false ]) : Url
Parameters
$parameter : string
$index : mixed = false
Return values
Url

scheme()

Return new Url with different protocol.

public scheme(string $protocol) : Url

Example: $url->schema('https']); returns the secure url without modifing the original url.

Parameters
$protocol : string
Return values
Url

setCurrentURL()

Set the current url (Mock a request).

public static setCurrentURL(string|Url $url) : mixed
Parameters
$url : string|Url
Return values
mixed

Search results