RouterInterface
Interface defining a HTTP path router.
| since |
2.0.0 |
|---|---|
| package |
Joomla Framework |
Methods
addRoute
Add a route to the router.
addRoute(\Joomla\Router\Route route) :
addRoutes
Add an array of route maps or objects to the router.
addRoutes(\Joomla\Router\Route[]|array[] routes) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- routes
array<string|int, Route>|array<string|int, array<string|int, mixed>>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( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
delete
Add a DELETE route to the router.
delete( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
get
Add a GET route to the router.
get( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>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||string|int
head
Add a HEAD route to the router.
head( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
options
Add a OPTIONS route to the router.
options( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>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( route, method = 'GET') : \Joomla\Router\ResolvedRoute
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- route
stringThe route string for which to find and execute a controller.- method
stringRequest method to match, should be a valid HTTP request method.
Response
patch
Add a PATCH route to the router.
patch( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
post
Add a POST route to the router.
post( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
put
Add a PUT route to the router.
put( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this
trace
Add a TRACE route to the router.
trace( pattern, controller, mixed||string|int rules = [], mixed||string|int defaults = []) :
| since |
2.0.0 |
|---|
Arguments
- pattern
stringThe route pattern to use for matching.- controller
mixedThe controller to map to the given pattern.- rules
array<string|int, mixed>An array of regex rules keyed using the route variables.- defaults
array<string|int, mixed>An array of default values that are used when the URL is matched.
Response
$this