$app
$app :
Properties
A container for routes.
handle(string $path, string $method = null) : mixed
Handle the routes and match them towards the request, dispatch them when a match is made. Each route handler may throw exceptions that may redirect to an internal route for error handling.
Several routes can match and if the routehandler does not break execution flow, the route matching will carry on. Only the last routehandler will get its return value returned further.
| string | $path | the path to find a matching handler for. |
| string | $method | the request method to match. |
content returned from route.
any(null|string|array $method, null|string|array $rule, null|string|callable $action) : \Anax\Route\class|array
Add a route with a request method, a path rule to match and an action as the callback. Adding several path rules (array) results in several routes being created.
| null|string|array | $method | as a valid request method. |
| null|string|array | $rule | path rule for this route. |
| null|string|callable | $action | to implement a handler for the route. |
as new route(s), class if one added, else array.
add(null|string|array $rule, null|string|callable $action = null) : \Anax\Route\class|array
Add a route to the router by rule(s) and a callback.
| null|string|array | $rule | for this route. |
| null|string|callable | $action | a callback handler for the route. |
as new route(s), class if one added, else array.
all(null|string|array $method, null|string|callable $action) : \Anax\Route\class|array
Add a default route which will be applied for any path, if the choosen request method is matching.
| null|string|array | $method | as request methods |
| null|string|callable | $action | a callback handler for the route. |
as new route(s), class if one added, else array.
addInternal(string $rule, null|string|callable $action) : \Anax\Route\class|array
Add an internal route to the router, this route is not exposed to the browser and the end user.
| string | $rule | for this route |
| null|string|callable | $action | a callback handler for the route. |
as new route(s), class if one added, else array.