phpDocumentor

RouteCollector

Interface RouteCollector

Table of Contents

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

Methods

any()

Add route for any HTTP method

public any(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

delete()

Add DELETE route

public delete(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

get()

Add GET route

public get(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

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
Return values
Route|null

getDefinedRouteGroup()

Returns a previous defined route group by its given pattern.

public getDefinedRouteGroup(string $pattern) : RouteGroup|null
Parameters
$pattern : string
Return values
RouteGroup|null

group()

Route Groups

public group(string $pattern, string|callable $callable) : RouteGroup

This method accepts a route pattern and a callback. All route declarations in the callback will be prepended by the group(s) that it is in.

Parameters
$pattern : string
$callable : string|callable
Return values
RouteGroup

map()

Add route with multiple methods

public map(array<string|int, string> $methods, string $pattern, callable|string $callable) : Route
Parameters
$methods : array<string|int, string>

Numeric array of HTTP method names

$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

options()

Add OPTIONS route

public options(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

patch()

Add PATCH route

public patch(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

post()

Add POST route

public post(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

put()

Add PUT route

public put(string $pattern, callable|string $callable) : Route
Parameters
$pattern : string

The route URI pattern

$callable : callable|string

The route callback routine

Return values
Route

redirect()

Add a route that sends an HTTP redirect

public redirect(string $from, string|UriInterface $to[, int $status = 302 ]) : Route
Parameters
$from : string
$to : string|UriInterface
$status : int = 302
Return values
Route

Search results