amajot/plates-catchall-templater

Allows you to render templates without defined routes/actions as a kind of catch-all in Zend Expressive

2.0.0 2017-08-29 16:48 UTC

This package is not auto-updated.

Last update: 2021-10-16 12:30:40 UTC


README

Build Status

middleware that will render templates without predefined routes or actions

Installation

Install this library using composer:

$ composer require amajot/plates-catchall-templater

Add a factory in dependencies.global.php

Amajot\CatchAllTemplateRenderer\CatchAllTemplateRenderer::class => Amajot\CatchAllTemplateRenderer\CatchAllTemplateRendererFactory::class,

Add the Middleware in the pipeline before the 404 handler

use Amajot\CatchAllTemplateRenderer\CatchAllTemplateRenderer;
...
// At this point, if no Response is return by any middleware, the
// NotFoundHandler kicks in; alternately, you can provide other fallback
// middleware to execute.
$app->pipe(CatchAllTemplateRenderer::class);
$app->pipe(NotFoundHandler::class);