PHP Class CapMousse\ReactRestify\Routing\Router

Inheritance: extends CapMousse\ReactRestify\Evenement\EventEmitter
Show file Open project: capmousse/react-restify Class Usage Examples

Public Properties

Property Type Description
$routes array The current routes list

Public Methods

Method Description
__construct ( array $routes = [] ) : Router Create a new routing element
addGroup ( String $prefix, $callback ) : CapMousse\ReactRestify\Routing\Group Create a new group of routes
addRoute ( String $method, String $route, Callable $callback ) Add a new route
addRoutes ( array $routes ) : Void Add routes
launch ( Request $request, CapMousse\ReactRestify\Http\Response $response, $next ) : Void Launch the route parsing

Private Methods

Method Description
matchRoutes ( Request $request, CapMousse\ReactRestify\Http\Response $response, $next ) : Void Try to match the current uri with all routes

Method Details

__construct() public method

Create a new routing element
public __construct ( array $routes = [] ) : Router
$routes array a route array
return Router

addGroup() public method

Create a new group of routes
public addGroup ( String $prefix, $callback ) : CapMousse\ReactRestify\Routing\Group
$prefix String prefix of thes routes
return CapMousse\ReactRestify\Routing\Group

addRoute() public method

Add a new route
public addRoute ( String $method, String $route, Callable $callback )
$method String type of route
$route String uri to catch
$callback Callable

addRoutes() public method

Add routes
public addRoutes ( array $routes ) : Void
$routes array a route array
return Void

launch() public method

Launch the route parsing
public launch ( Request $request, CapMousse\ReactRestify\Http\Response $response, $next ) : Void
$request CapMousse\ReactRestify\Http\Request
$response CapMousse\ReactRestify\Http\Response
return Void

Property Details

$routes public property

The current routes list
public array $routes
return array