Index Documentation

ScopedRouter
in package
implements IRouter uses RouterTrait

Provides a scoped router interface, automatically adds a prefix to any routes added.

Table of Contents

Interfaces

IRouter

Methods

__construct()  : mixed
add()  : void
Adds a new route.
delete()  : void
get()  : void
options()  : void
patch()  : void
post()  : void
put()  : void
register()  : void
resolve()  : ResolvedRouteInfo
Resolves a route
scopeTo()  : IRouter
Creates a scoped version of this router.
use()  : void
Apply middleware functions to a path.

Methods

__construct()

public __construct(IRouter $router, string $prefix) : mixed
Parameters
$router : IRouter

Underlying router.

$prefix : string

Base path to use as a prefix.

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.

delete()

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

get()

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

options()

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

patch()

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

post()

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

put()

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

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