Router Class

Aurora\Router Namespace

Interfaces

Traits


Properties

directory

Directory path

protected $directory = '/': string

default

Default route

protected $default = '/index': string

groups

Groups array

protected $groups = []: array

Methods

setDirectory

Set the directory path

Parameters

  • string $directory — Directory path

Return Value

  • $this

Signature

public function setDirectory(string $directory)

setDefault

Set the dafult route

Parameters

  • string $default — Default route

Return Value

  • $this

Signature

public function setDefault(string $default)

group

Create a new route group

Parameters

  • string $prefix — Group prefix
  • callable $closure — Group definition callback

Return Value

  • \RouteGroup

Signature

public function group(string $prefix, callable $closure): Aurora\Router\RouteGroup

dispatch

Dispatch the request

Parameters

  • Psr\Http\Message\ServerRequestInterface $request — Request object
  • Psr\Http\Message\ResponseFactoryInterface $factory — Response factory

Return Value

  • \ResponseInterface

Signature

public function dispatch(Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseFactoryInterface $factory): Psr\Http\Message\ResponseInterface

compile

Compile route patterns

Return Value

  • array

Signature

protected function compile(): array

flatten

Flatten route groups

Parameters

  • Aurora\Router\RouteGroup $group — Route group to flatten
  • string $prefix — Current prefix

Signature

protected function flatten(Aurora\Router\RouteGroup $group, string $prefix = '')

Go to top