Router
Implements RouterInterface, SerializableA path router.
since |
1.0 |
---|---|
package |
Joomla Framework |
Methods
__construct
Constructor.
__construct(\Joomla\Router\Route[]|array[] routes = []) : mixed
since |
1.0 |
---|
Arguments
- routes
\Joomla\Router\Route[]|array[]
A list of route maps or Route objects to add to the router.
Response
mixed
__serialize
Serialize the router.
__serialize() : array
since |
2.0.0 |
---|
Response
array
The data to be serialized
__unserialize
Unserialize the router.
__unserialize(array data) : void
since |
2.0.0 |
---|
Arguments
- data
array
The serialized router.
addRoute
Add a route to the router.
addRoute(\Joomla\Router\Route route) : $this
since |
2.0.0 |
---|
Arguments
- route
\Joomla\Router\Route
The route definition
Response
$this
addRoutes
Add an array of route maps or objects to the router.
addRoutes(\Joomla\Router\Route[]|array[] routes) : $this
since |
2.0.0 |
---|---|
throws |
|
Arguments
- routes
\Joomla\Router\Route[]|array[]
A list of route maps or Route objects to add to the router.
Response
$this
all
Add a route to the router that accepts all request methods.
all(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
delete
Add a DELETE route to the router.
delete(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
get
Add a GET route to the router.
get(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
getRoutes
Get the routes registered with this router.
getRoutes() : \Joomla\Router\Route[]
since |
2.0.0 |
---|
Response
\Joomla\Router\Route[]
head
Add a HEAD route to the router.
head(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
options
Add a OPTIONS route to the router.
options(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
parseRoute
Parse the given route and return the information about the route, including the controller assigned to the route.
parseRoute(string route, string method = 'GET') : \Joomla\Router\ResolvedRoute
since |
1.0 |
---|---|
throws |
|
Arguments
- route
string
The route string for which to find and execute a controller.- method
string
Request method to match, should be a valid HTTP request method.
Response
\Joomla\Router\ResolvedRoute
patch
Add a PATCH route to the router.
patch(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
post
Add a POST route to the router.
post(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
put
Add a PUT route to the router.
put(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
serialize
Serialize the router.
serialize() : string
since |
2.0.0 |
---|
Response
string
The serialized router.
trace
Add a TRACE route to the router.
trace(string pattern, mixed controller, array rules = [], array defaults = []) : $this
since |
2.0.0 |
---|
Arguments
- pattern
string
The route pattern to use for matching.- controller
mixed
The controller to map to the given pattern.- rules
array
An array of regex rules keyed using the route variables.- defaults
array
An array of default values that are used when the URL is matched.
Response
$this
unserialize
Unserialize the router.
unserialize(string serialized) : void
since |
2.0.0 |
---|
Arguments
- serialized
string
The serialized router.
Properties
routes
An array of Route objects defining the supported paths.
since |
2.0.0 |
---|
Type(s)
\Joomla\Router\Route[]