RouterInterface
in
PHP Mini Framework
Tags
Table of Contents
- addRoute() : self
- addRoutes() : self
- createRoute() : RouteInterface
- getRoutes() : array<string|int, RouteInterface>
- isMatch() : bool|array<string|int, mixed>
- Check if path matches
- process() : array<string|int, MiddlewareInterface>
- Process routing
Methods
addRoute()
public
addRoute(RouteInterface $route) : self
Parameters
- $route : RouteInterface
Tags
Return values
self —addRoutes()
public
addRoutes(array<string|int, mixed> $routes) : self
Parameters
- $routes : array<string|int, mixed>
Tags
Return values
self —createRoute()
public
createRoute(string $method, string $path) : RouteInterface
Parameters
- $method : string
- $path : string
Tags
Return values
RouteInterface —getRoutes()
public
getRoutes() : array<string|int, RouteInterface>
Tags
Return values
array<string|int, RouteInterface> —isMatch()
Check if path matches
public
isMatch(string $path, string $route[, bool $startsWith = true ][, mixed $endsWith = true ]) : bool|array<string|int, mixed>
Parameters
- $path : string
-
Request path
- $route : string
-
Route to compare to
- $startsWith : bool = true
-
path ends with route
- $endsWith : mixed = true
Tags
Return values
bool|array<string|int, mixed> —process()
Process routing
public
process([RequestInterface|RouteInterface|null $request = null ]) : array<string|int, MiddlewareInterface>
Parameters
- $request : RequestInterface|RouteInterface|null = null