class Uri (View source)

Constants

ASCII

Use with Uri::encodepath for allow path with ascii characters

UNICODE

Use with Uri::encodepath for allow path with unicode

Properties

static protected array $defaultPorts Define default port to schemes, you can customize in a extended class If put a new port with scheme he is removed in final url, eg. 'myscheme:900', ClassExtendedFromUri::normalize('myscheme://host:900/test') => myscheme://host/test
static protected array $defaultSchemes Define default schemes, you can customize in a extended class If put a new scheme the host is converted to lower-case, eg. 'whatsapp', Uri::normalize('whatsapp://SEND?text=foo') => whatsapp://send?text=foo

Methods

static string
encodepath(string $path, int $type = null)

Convert text to URL format

static string
canonpath(string $path)

Canonicalize paths

static string|bool
normalize(string $url)

Normalize URL, include canonicalized path

static string
root(string $path = '')

Create URL based in public root application, for example, if you install inphinit in a sub path like: http://site/foo/bar/myapplication/

static string
canonquery($query, $prefix = '')

Reorder querystring by "keys" if: Uri::canonquery('z=1&u=2&a=5') returns a=5&u=2&z=1

Details

static string encodepath(string $path, int $type = null)

Convert text to URL format

Parameters

string $path
int $type

Return Value

string

static string canonpath(string $path)

Canonicalize paths

Parameters

string $path

Return Value

string

static string|bool normalize(string $url)

Normalize URL, include canonicalized path

Parameters

string $url

Return Value

string|bool

static string root(string $path = '')

Create URL based in public root application, for example, if you install inphinit in a sub path like: http://site/foo/bar/myapplication/

Parameters

string $path

Return Value

string

static string canonquery($query, $prefix = '')

Reorder querystring by "keys" if: Uri::canonquery('z=1&u=2&a=5') returns a=5&u=2&z=1

Parameters

$query
$prefix

Return Value

string