Documentation

Core_Router_Route
in package

Routes

$oCore_Router_Route = new Core_Router_Route('/news/({path})(page-{page}/)(tag/{tag}/)'); $oCore_Router_Route->setUri('/news/page-17/') ->execute() ->compress() ->sendHeaders() ->showBody();
Tags
subpackage

Core\Router

version
7.x
copyright

© 2005-2025, https://www.hostcms.ru

Table of Contents

Properties

$_action  : string
Action name
$_controller  : string
Controller name
$_controllerColumns  : array<string|int, mixed>
Array of columns will be set for controller object
$_middlewares  : array<string|int, mixed>
Middleware stack
$_pregPattern  : string
Preg pattern
$_uri  : string
URI
$_uriPattern  : string
URI pattern

Methods

__construct()  : mixed
Constructor.
action()  : Core_Router_Route
Set action name
addMiddleware()  : self
Add middleware to the route
applyPattern()  : mixed
Apply pattern
check()  : bool
Check URI
controller()  : Core_Router_Route
Set controller name
execute()  : mixed
Set controller columns and execute command controller method '{action}Action()'.
middleware()  : self
Add middleware to the route
prependMiddleware()  : self
Prepend middleware to the route
removeMiddleware()  : self
Exclude middleware to the route
setUri()  : Core_Router_Route
Set URI
withoutMiddleware()  : self
Exclude middleware to the route
_wrapMiddleware()  : callable
Wrap middleware around the controller handler

Properties

$_action

Action name

protected string $_action = 'show'

$_controller

Controller name

protected string $_controller = 'Core_Command_Controller_Default'

$_controllerColumns

Array of columns will be set for controller object

protected array<string|int, mixed> $_controllerColumns = array()

$_middlewares

Middleware stack

protected array<string|int, mixed> $_middlewares = array()

$_pregPattern

Preg pattern

protected string $_pregPattern = \NULL

$_uri

URI

protected string $_uri = \NULL

$_uriPattern

URI pattern

protected string $_uriPattern = \NULL

Methods

__construct()

Constructor.

public __construct([string $uriPattern = NULL ][, array<string|int, mixed> $expressions = array() ]) : mixed
Parameters
$uriPattern : string = NULL

URI pattern. Named subpatterns {name} can consist of up to 32 alphanumeric characters and underscores, but must start with a non-digit.

$expressions : array<string|int, mixed> = array()

list of expressions

addMiddleware()

Add middleware to the route

public addMiddleware(string $middleware[, callable|null $callable = NULL ]) : self
Parameters
$middleware : string
$callable : callable|null = NULL
Tags
see
middleware()
Return values
self

applyPattern()

Apply pattern

public applyPattern(string $uri) : mixed
Parameters
$uri : string

URI

Return values
mixed

array with data from URI or NULL

check()

Check URI

public check(string $uri) : bool
Parameters
$uri : string

URI

Return values
bool

execute()

Set controller columns and execute command controller method '{action}Action()'.

public execute() : mixed

Default action name is showAction()

Return values
mixed

expect Core_Response

middleware()

Add middleware to the route

public middleware(string $middleware[, callable|null $callable = NULL ]) : self
Parameters
$middleware : string
$callable : callable|null = NULL
Return values
self

prependMiddleware()

Prepend middleware to the route

public prependMiddleware(string $middleware[, callable|null $callable = NULL ]) : self
Parameters
$middleware : string
$callable : callable|null = NULL
Return values
self

removeMiddleware()

Exclude middleware to the route

public removeMiddleware(string $middleware) : self
Parameters
$middleware : string
Tags
see
withoutMiddleware()
Return values
self

withoutMiddleware()

Exclude middleware to the route

public withoutMiddleware(string $middleware) : self
Parameters
$middleware : string
Return values
self

_wrapMiddleware()

Wrap middleware around the controller handler

protected _wrapMiddleware(object $oController, callable $next) : callable
Parameters
$oController : object
$next : callable
Return values
callable

        
On this page

Search results