Router

Class to create and parse routes

since

1.5

Methods

__construct

Class constructor

__construct(array $options = array()) 
since

1.5

Arguments

$options

arrayArray of options

_buildRawRoute

Function to build a raw route

_buildRawRoute( &$uri) : string
deprecated
since

1.5

deprecated

4.0 Attach your logic as rule to the main build stage

Arguments

$uri

Response

stringRaw Route

_buildSefRoute

Function to build a sef route

_buildSefRoute( &$uri) : string
deprecated
since

1.5

deprecated

4.0 Attach your logic as rule to the main build stage

Arguments

$uri

Response

stringThe SEF route

_createUri

Create a uri based on a full or partial URL string

_createUri(string $url) : \JUri
deprecated
since

1.5

deprecated

4.0 Use createUri() instead

Arguments

$url

stringThe URI

Response

\JUri

_decodeSegments

Decode route segments

_decodeSegments(array $segments) : array
deprecated
since

1.5

deprecated

4.0 This should be performed in the component router instead

Arguments

$segments

arrayAn array of route segments

Response

arrayArray of decoded route segments

_encodeSegments

Encode route segments

_encodeSegments(array $segments) : array
deprecated
since

1.5

deprecated

4.0 This should be performed in the component router instead

Arguments

$segments

arrayAn array of route segments

Response

arrayArray of encoded route segments

_parseRawRoute

Function to convert a raw route to an internal URI

_parseRawRoute( &$uri) : boolean
deprecated
since

1.5

deprecated

4.0 Attach your logic as rule to the main parse stage

Arguments

$uri

Response

boolean

_parseSefRoute

Function to convert a sef route to an internal URI

_parseSefRoute( &$uri) : string
deprecated
since

1.5

deprecated

4.0 Attach your logic as rule to the main parse stage

Arguments

$uri

Response

stringInternal URI

_processBuildRules

Process the build uri query data based on custom defined rules

_processBuildRules( &$uri) : void
deprecated
since

1.5

deprecated

4.0 Use processBuildRules() instead

Arguments

$uri

_processParseRules

Process the parsed router variables based on custom defined rules

_processParseRules( &$uri) : array
deprecated
since

1.5

deprecated

4.0 Use processParseRules() instead

Arguments

$uri

Response

arrayThe array of processed URI variables

attachBuildRule

Attach a build rule

attachBuildRule(callable $callback, string $stage = self::PROCESS_DURING) : void
since

1.5

Arguments

$callback

callableThe function to be called

$stage

stringThe stage of the build process that this should be added to. Possible values: 'preprocess', '' for the main build process, 'postprocess'

attachParseRule

Attach a parse rule

attachParseRule(callable $callback, string $stage = self::PROCESS_DURING) : void
since

1.5

Arguments

$callback

callableThe function to be called.

$stage

stringThe stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'

build

Function to convert an internal URI to a route

build(string $url) : \JUri
since

1.5

Arguments

$url

stringThe internal URL or an associative array

Response

\JUriThe absolute search engine friendly URL object

buildRawRoute

Function to build a raw route

buildRawRoute( &$uri) : string
deprecated
since

3.2

deprecated

4.0 Attach your logic as rule to the main build stage

Arguments

$uri

Response

stringRaw Route

buildSefRoute

Function to build a sef route

buildSefRoute( &$uri) : string
deprecated
since

3.2

deprecated

4.0 Attach your logic as rule to the main build stage

Arguments

$uri

Response

stringThe SEF route

createUri

Create a uri based on a full or partial URL string

createUri(string $url) : \JUri
since

3.2

Arguments

$url

stringThe URI or an associative array

Response

\JUri

decodeSegments

Decode route segments

decodeSegments(array $segments) : array
deprecated
since

3.2

deprecated

4.0 This should be performed in the component router instead

Arguments

$segments

arrayAn array of route segments

Response

arrayArray of decoded route segments

encodeSegments

Encode route segments

encodeSegments(array $segments) : array
deprecated
since

3.2

deprecated

4.0 This should be performed in the component router instead

Arguments

$segments

arrayAn array of route segments

Response

arrayArray of encoded route segments

getInstance

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

getInstance(string $client, array $options = array()) : \Joomla\CMS\Router\Router
static
since

1.5

throws

\RuntimeException

Arguments

$client

stringThe name of the client

$options

arrayAn associative array of options

Response

\Joomla\CMS\Router\RouterA Router object.

getMode

Get the router mode

getMode() : integer
deprecated
since

1.5

deprecated

4.0

Response

integer

getVar

Get a router variable

getVar(string $key) : mixed
since

1.5

Arguments

$key

stringThe name of the variable

Response

mixedValue of the variable

getVars

Get the router variable array

getVars() : array
since

1.5

Response

arrayAn associative array of router variables

parse

Function to convert a route to an internal URI

parse( &$uri) : array
since

1.5

Arguments

$uri

Response

array

parseRawRoute

Function to convert a raw route to an internal URI

parseRawRoute( &$uri) : array
deprecated
since

3.2

deprecated

4.0 Attach your logic as rule to the main parse stage

Arguments

$uri

Response

arrayArray of variables

parseSefRoute

Function to convert a sef route to an internal URI

parseSefRoute( &$uri) : array
deprecated
since

3.2

deprecated

4.0 Attach your logic as rule to the main parse stage

Arguments

$uri

Response

arrayArray of variables

processBuildRules

Process the build uri query data based on custom defined rules

processBuildRules( &$uri, string $stage = self::PROCESS_DURING) : void
since

3.2

Arguments

$uri

$stage

stringThe stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main build stage

processParseRules

Process the parsed router variables based on custom defined rules

processParseRules( &$uri, string $stage = self::PROCESS_DURING) : array
since

3.2

Arguments

$uri

$stage

stringThe stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main parse stage

Response

arrayThe array of processed URI variables

setMode

Set the router mode

setMode(integer $mode) : void
deprecated
since

1.5

deprecated

4.0

Arguments

$mode

integerThe routing mode.

setVar

Set a router variable, creating it if it doesn't exist

setVar(string $key, mixed $value, boolean $create = true) : void
since

1.5

Arguments

$key

stringThe name of the variable

$value

mixedThe value of the variable

$create

booleanIf True, the variable will be created if it doesn't exist yet

setVars

Set the router variable array

setVars(array $vars = array(), boolean $merge = true) : void
since

1.5

Arguments

$vars

arrayAn associative array with variables

$merge

booleanIf True, the array will be merged instead of overwritten

Constants

PROCESS_BEFORE

Mask for the before process stage

since

3.4

PROCESS_DURING

Mask for the during process stage

since

3.4

PROCESS_AFTER

Mask for the after process stage

since

3.4

Properties

mode

The rewrite mode

deprecated
since

1.5

deprecated

4.0

Type(s)

integer

_mode

The rewrite mode

deprecated
since

1.5

deprecated

4.0

Type(s)

integer

vars

An array of variables

since

1.5

Type(s)

array

_vars

An array of variables

deprecated
since

1.5

deprecated

4.0 Will convert to $vars

Type(s)

array

rules

An array of rules

since

1.5

Type(s)

array

_rules

An array of rules

deprecated
since

1.5

deprecated

4.0 Will convert to $rules

Type(s)

array

cache

Caching of processed URIs

since

3.3

Type(s)

array

instances

Router instances container.

static
since

1.7

Type(s)

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