\LiftKit\RouterHttp

HTTP Router

A special router that provides utility methods for creating routes specific to HTTP Requests

Summary

Methods
Properties
Constants
registerRoute()
execute()
registerController()
registerControllerFactory()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

registerRoute()

registerRoute(\LiftKit\Router\Route\Route  $route, string  $routeIdentifier = null) 

Registers a new Route

Parameters

\LiftKit\Router\Route\Route $route

Route object

string $routeIdentifier

A string identifier for the Route. Optional.

execute()

execute(\LiftKit\Request\Request  $request) : \LiftKit\Response\Response

Iterates over stored routes in the order they were registered. Executes the first matching route.

Parameters

\LiftKit\Request\Request $request

An object that represents the request.

Returns

\LiftKit\Response\Response

registerController()

registerController(string  $baseUri, \LiftKit\Controller\Controller  $controller, null  $routeIdentifier = null) 

This utility method registers a \LiftKit\Router\Route\Http\Controller route. It matches based on the $baseUri parameter and whether the controller has a method with a matching name.

Parameters

string $baseUri

The URI to attach the controller to

\LiftKit\Controller\Controller $controller

A Controller for requests that match

null $routeIdentifier

An optional string identifier

registerControllerFactory()

registerControllerFactory(string  $baseUri, callable  $callback, null  $routeIdentifier = null) 

This utility method registers a \LiftKit\Router\Route\Http\ControllerFactory route. It matches based on the $baseUri parameter and whether the controller has a method with a matching name.

Parameters

string $baseUri

The URI to attach the controller to

callable $callback

A callback function to create the Controller

null $routeIdentifier

An optional string identifier