__construct()
__construct(array $data)
Create new template route
Required dependencies
config
— ScriptRouteConfig
Parameters
array | $data | Dependencies. |
Template Route Handler.
A route handler is a simple invokale
object with the signature:
__invoke(Container $container, RequestInterface $request, ResponseInterface $response)
It is only called (invoked) when a route is matched.
This is the default "Slim Route Handler" for template style routes.
It uses a TemplateRouteConfig
to properly either:
Templates can be any objects that can be loaded with a "TemplateFactory".
The Template Factory used is an external dependency (template/factory
) expected to be set on the container.
Template-level cache is possible by setting the "cache" config option to true. Cached template can not have any options; they will always return the exact same content for all "template".
createConfig(mixed|null $data = null) : \Charcoal\App\Route\TemplateRouteConfig
ConfigurableTrait > createConfig()
mixed|null | $data | Optional config data. |
__invoke(\Pimple\Container $container, \Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response) : \Psr\Http\Message\ResponseInterface
\Pimple\Container | $container | A DI (Pimple) container. |
\Psr\Http\Message\RequestInterface | $request | A PSR-7 compatible Request instance. |
\Psr\Http\Message\ResponseInterface | $response | A PSR-7 compatible Response instance. |