\Charcoal\App\RouteRouteManager

The route manager takes care of dispatching each route from an app or a module config

Summary

Methods
Properties
Constants
setApp()
__construct()
setupRoutes()
No public properties found
No constants found
app()
No protected properties found
N/A
setupTemplate()
setupAction()
setupScript()
$app
$routeData
N/A

Properties

$routeData

$routeData : array

Additional route data.

Type

array

Methods

__construct()

__construct(array  $data) 

Manager constructor

Parameters

array $data

The dependencies container.

setupRoutes()

setupRoutes() : void

Set up the routes.

There are 3 types of routes:

  • Templates
  • Actions
  • Scripts

setupTemplate()

setupTemplate(string  $routeIdent, array|\ArrayAccess  $templateConfig) : \Slim\Route

Add template route.

Typically for a GET request, the route will render a template.

Parameters

string $routeIdent

The template's route identifier.

array|\ArrayAccess $templateConfig

The template's config for the route.

Returns

\Slim\Route

setupAction()

setupAction(string  $routeIdent, array|\ArrayAccess  $actionConfig) : \Slim\Route

Add action route.

Typically for a POST request, the route will execute an action (returns JSON).

Parameters

string $routeIdent

The action's route identifier.

array|\ArrayAccess $actionConfig

The action's config for the route.

Returns

\Slim\Route

setupScript()

setupScript(string  $routeIdent, array|\ArrayAccess  $scriptConfig) : \Slim\Route

Add script route.

Typically used for a CLI interface, the route will execute a script.

Parameters

string $routeIdent

The script's route identifier.

array|\ArrayAccess $scriptConfig

The script's config for the route.

Returns

\Slim\Route