amajot/plates-catchall-templater

此包已被弃用,不再维护。未建议替代包。

允许您在 Zend Expressive 中渲染没有定义路由/动作的模板,类似于通配符

2.0.0 2017-08-29 16:48 UTC

This package is not auto-updated.

Last update: 2022-07-23 16:15:38 UTC


README

Build Status

中间件,可以渲染没有预定义路由或动作的模板

安装

使用 composer 安装此库

$ composer require amajot/plates-catchall-templater

在 dependencies.global.php 中添加一个工厂

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

在 404 处理器之前将中间件添加到管道中

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);