Uri

Extends \Joomla\Uri\Uri

Uri Class

This class serves two purposes. First it parses a URI and provides a common interface for the Joomla Platform to access and manipulate a URI. Second it obtains the URI of the current executing script from the server regardless of server.

since

1.7.0

Methods

base

Returns the base URI for the request.

base(boolean $pathonly = false) : string
static
since

1.7.0

Arguments

$pathonly

booleanIf false, prepend the scheme, host and port information. Default is false.

Response

stringThe base URI string

buildQuery

Build a query from an array (reverse of the PHP parse_str()).

buildQuery(array $params) : string
static
see \Joomla\CMS\Uri\parse_str()
since

1.7.0

note

The parent method is protected, this exposes it as public for B/C

Arguments

$params

arrayThe array of key => value pairs to return as a query string.

Response

stringThe resulting query string.

current

Returns the URL for the request, minus the query.

current() : string
static
since

1.7.0

Response

string

getInstance

Returns the global Uri object, only creating it if it doesn't already exist.

getInstance(string $uri = 'SERVER') : \Joomla\CMS\Uri\Uri
static
since

1.7.0

Arguments

$uri

stringThe URI to parse. [optional: if null uses script URI]

Response

\Joomla\CMS\Uri\UriThe URI object.

isInternal

Checks if the supplied URL is internal

isInternal(string $url) : boolean
static
since

1.7.0

Arguments

$url

stringThe URL to check.

Response

booleanTrue if Internal.

parse

Parse a given URI and populate the class fields.

parse(string $uri) : boolean
since

1.7.0

note

The parent method is protected, this exposes it as public for B/C

Arguments

$uri

stringThe URI string to parse.

Response

booleanTrue on success.

reset

Method to reset class static members for testing and other various issues.

reset() : void
static
since

1.7.0

root

Returns the root URI for the request.

root(boolean $pathonly = false, string $path = null) : string
static
since

1.7.0

Arguments

$pathonly

booleanIf false, prepend the scheme, host and port information. Default is false.

$path

stringThe path

Response

stringThe root URI string.

Properties

instances

An array of Uri instances.

static
since

1.7.0

Type(s)

array<mixed,\Joomla\CMS\Uri\Uri>

base

The current calculated base url segments.

static
since

1.7.0

Type(s)

array

root

The current calculated root url segments.

static
since

1.7.0

Type(s)

array

current

The current url.

static
since

1.7.0

Type(s)

string