\LiftKit\Router\Route\HttpHttp

Abstract HTTp Router

An abstract class to provide utility method to HTTP-oriented routes.

An HTTP route matches a URI to Controller actions.

For example, an HTTP route attached to the base URI /example would route the following requests as follows:

  • '/example' would be routed to Controller::index()
  • '/example/page' would be routed to Controller::page()
  • '/example/page/arg1/arg2' would be routed to Controller::page('arg1', 'arg2')
  • '/example/another-page' would be routed to Controller::anotherPage() ...

Summary

Methods
Properties
Constants
__construct()
isValid()
execute()
No public properties found
No constants found
No protected methods found
$baseUri
N/A
No private methods found
No private properties found
N/A

Properties

$baseUri

$baseUri : string

Base URI to attach route to

Type

string

Methods

__construct()

__construct(callable  $condition, callable  $callback) 

Constructor

Parameters

callable $condition

Callback that takes a Request as a parameter and returns a boolean indicating whether the Route matches

callable $callback

Callback that represents the action to be taken if the route matches, takes a Request as a parameter

isValid()

isValid(\LiftKit\Request\Request  $request) : boolean

Returns true if request matches route, false if it doesn't

Parameters

\LiftKit\Request\Request $request

Request Object

Returns

boolean