PHP Interface Autarky\Routing\RouterInterface

Afficher le fichier Open project: autarky/framework Interface Usage Examples

Méthodes publiques

Méthode Description
addRoute ( string | array $method, string $path, string $handler, string $name = null ) Add a route to the router.
dispatch ( Request $request ) : Response Dispatch a request in the router.
getCurrentRoute ( ) : Route Get the route matched to the current request.
getRoute ( string $name ) : Route Given a route name, get the route object.
group ( array $flags, Closure $callback ) : void Define a route group.
mount ( array $routes, string $path = '/' ) : void Mount an array config onto the routes.

Method Details

addRoute() public méthode

Add a route to the router.
public addRoute ( string | array $method, string $path, string $handler, string $name = null )
$method string | array HTTP methods the route should respond to
$path string Relative URL the route should respond to. Parameters wrapped in }
$handler string string of "class:method" or "global_function"
$name string Route name (optional)

dispatch() public méthode

Dispatch a request in the router.
public dispatch ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
Résultat Symfony\Component\HttpFoundation\Response

getCurrentRoute() public méthode

Get the route matched to the current request.
public getCurrentRoute ( ) : Route
Résultat Route

getRoute() public méthode

Given a route name, get the route object.
public getRoute ( string $name ) : Route
$name string
Résultat Route

group() public méthode

Define a route group.
public group ( array $flags, Closure $callback ) : void
$flags array Valid keys are 'before', 'after', 'prefix'
$callback Closure First argument is the router ($this)
Résultat void

mount() public méthode

Mount an array config onto the routes.
public mount ( array $routes, string $path = '/' ) : void
$routes array
$path string
Résultat void