HttpRouteCollector
in package
implements
RouteCollector
Class HttpRouteCollector
Tags
Interfaces, Classes and Traits
- RouteCollector
- Interface RouteCollector
Table of Contents
- $groups : array<string, RouteGroupInterface>
- $internal : RouteCollectorProxyInterface
- $routes : array<string, RouteInterface>
- __construct() : mixed
- HttpRouteCollector constructor.
- any() : Route
- Add route for any HTTP method
- delete() : Route
- Add DELETE route
- get() : Route
- Add GET route
- getDefinedRoute() : Route|null
- Returns a previous defined route by its given pattern and method.
- getDefinedRouteGroup() : RouteGroup|null
- Returns a previous defined route group by its given pattern.
- group() : RouteGroup
- Route Groups
- map() : Route
- Add route with multiple methods
- options() : Route
- Add OPTIONS route
- patch() : Route
- Add PATCH route
- post() : Route
- Add POST route
- put() : Route
- Add PUT route
- redirect() : Route
- Add a route that sends an HTTP redirect
- storeDefinedRoute() : void
- Stores a defined route internally.
- storeDefinedRouteGroup() : void
- Stores a defined route group internally.
Properties
$groups
private
array<string, RouteGroupInterface>
$groups
$internal
private
RouteCollectorProxyInterface
$internal
$routes
private
array<string, RouteInterface>
$routes
Methods
__construct()
HttpRouteCollector constructor.
public
__construct(RouteCollectorProxyInterface $internal) : mixed
Parameters
- $internal : RouteCollectorProxyInterface
Return values
mixed —any()
Add route for any HTTP method
public
any(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —delete()
Add DELETE route
public
delete(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —get()
Add GET route
public
get(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —getDefinedRoute()
Returns a previous defined route by its given pattern and method.
public
getDefinedRoute(string $pattern, string $method) : Route|null
Parameters
- $pattern : string
- $method : string
Tags
Return values
Route|null —getDefinedRouteGroup()
Returns a previous defined route group by its given pattern.
public
getDefinedRouteGroup(string $pattern) : RouteGroup|null
Parameters
- $pattern : string
Tags
Return values
RouteGroup|null —group()
Route Groups
public
group(string $pattern, mixed $callable) : RouteGroup
Parameters
- $pattern : string
- $callable : mixed
Tags
Return values
RouteGroup —map()
Add route with multiple methods
public
map(array<string|int, mixed> $methods, string $pattern, mixed $callable) : Route
Parameters
- $methods : array<string|int, mixed>
-
Numeric array of HTTP method names
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —options()
Add OPTIONS route
public
options(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —patch()
Add PATCH route
public
patch(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —post()
Add POST route
public
post(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —put()
Add PUT route
public
put(string $pattern, mixed $callable) : Route
Parameters
- $pattern : string
-
The route URI pattern
- $callable : mixed
-
The route callback routine
Tags
Return values
Route —redirect()
Add a route that sends an HTTP redirect
public
redirect(string $from, mixed $to[, int $status = 302 ]) : Route
Parameters
- $from : string
- $to : mixed
- $status : int = 302
Tags
Return values
Route —storeDefinedRoute()
Stores a defined route internally.
private
storeDefinedRoute(RouteInterface $route) : void
Parameters
- $route : RouteInterface
Return values
void —storeDefinedRouteGroup()
Stores a defined route group internally.
private
storeDefinedRouteGroup(RouteGroupInterface $group) : void
Parameters
- $group : RouteGroupInterface