REST
Less than 1 minute
REST
Properties
request
The request object.
protected Request $request
Methods
initialize
Initializes the REST controller.
public initialize({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$request | Request |
runAction
This method runs the REST API endpoint by matching the request method and path with the available endpoints.
public runAction({Array})
If a match is found, it sets the endpoint and its arguments and breaks the loop. If the request method is OPTIONS, it returns a JSON response with the allowed methods for the endpoint. If the endpoint is not found, it throws a 404 exception. If the endpoint is found and the 'init' method exists, it calls the 'init' method and returns its response if it is an instance of \Hazaar\Controller\Response. Otherwise, it executes the endpoint with its arguments and returns the response.
Parameters
Parameter | Type | Description |
---|---|---|
$actionName | string | |
$actionArgs | array | |
$namedActionArgs | bool |
init
Initializes the REST controller.
protected init({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$request | HTTP |
initResponse
protected initResponse({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$request | HTTP |
Generated by Hazaar API Doc Generator