wtf/html

WTF 框架的 HTML 包

1.0.4 2018-03-28 08:28 UTC

This package is auto-updated.

Last update: 2024-09-13 22:35:47 UTC


README

Build Status Coverage Status

此包包含 WTF 框架的 Twig 模板引擎、闪存消息和有用的 Session 类

安装

通过 Composer 安装

composer require wtf/html

配置您的应用程序

创建配置文件 html.php

<?php

declare(strict_types=1);

$cache_dir = __DIR__.'/../cache';

return [
    'template_path' => __DIR__.'/../views/',
    'cache_path' => __DIR__.'/../cache',
];

可选:创建 csrf.php 配置

<?php

declare(strict_types=1);

return [
    'failure_callable' => function ($request, $response, $next) { //@link https://github.com/slimphp/Slim-Csrf#handling-validation-failure
        $request = $request->withAttribute("csrf_status", false);
        return $next($request, $response);
    }
];

添加新的提供者和中间件

  1. \Wtf\Html\Provider 添加到您的提供者列表中(suit.php 配置)
  2. session_middlewarecsrf_middleware 添加到您的中间件列表中(suit.php 配置)
  3. 在您的公开 index.php 中添加 session_start()

文档

插件目前扩展了以下插件。有关如何在您的应用程序中使用它们的说明链接如下。