\LiftKit\Router\Route\Http\RestRest

REST HTTP Route

This class and its decendents map requests to controller actions differently than a normal HTTP route.

For example, this is how a REST Route attached to /examples would route the following requests:

  • GET '/example' would be routed to Controller::index()
  • GET '/example/1' would be routed to Controller::get(1)
  • POST '/example' would be routed to Controller::insert()
  • POST '/example/1' would be routed to Controller::update(1)
  • DELETE '/example/1' would be routed to Controller::delete(1)

Summary

Methods
Properties
Constants
isValid()
execute()
__construct()
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

isValid()

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

Returns whether the route matches the supplied request

Parameters

\LiftKit\Request\Request $request

Returns

boolean

__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