Index Documentation

IRouter
in

Table of Contents

Methods

add()  : void
Adds a new route.
delete()  : void
Adds a new DELETE route.
get()  : void
Adds a new GET route.
options()  : void
Adds a new OPTIONS route.
patch()  : void
Adds a new PATCH route.
post()  : void
Adds a new POST route.
put()  : void
Adds a new PUT route.
register()  : void
Registers routes in an IRouteHandler implementation.
resolve()  : ResolvedRouteInfo
Resolves a route
scopeTo()  : IRouter
Creates a scoped version of this router.
use()  : void
Apply middleware functions to a path.

Methods

add()

Adds a new route.

public add(string $method, string $path, callable $handler) : void
Parameters
$method : string

Request method.

$path : string

Request path.

$handler : callable

Request handler.

Tags
throws
InvalidArgumentException

if $method is not a valid method name

delete()

Adds a new DELETE route.

public delete(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

get()

Adds a new GET route.

public get(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

options()

Adds a new OPTIONS route.

public options(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

patch()

Adds a new PATCH route.

public patch(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

post()

Adds a new POST route.

public post(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

put()

Adds a new PUT route.

public put(string $path, callable $handler) : void
Parameters
$path : string

Request path.

$handler : callable

Request handler.

resolve()

Resolves a route

public resolve(string $method, string $path) : ResolvedRouteInfo
Parameters
$method : string

Request method.

$path : string

Request path.

Return values
ResolvedRouteInfo

Response route.

scopeTo()

Creates a scoped version of this router.

public scopeTo(string $prefix) : IRouter
Parameters
$prefix : string

Prefix path to prepend to all registered routes.

Return values
IRouter

Scoped router.

use()

Apply middleware functions to a path.

public use(string $path, callable $handler) : void
Parameters
$path : string

Path to apply the middleware to.

$handler : callable

Middleware function.


        
On this page

Search results