weew/app-twig

weew/app 包的 Twig 集成。

v1.2.1 2016-07-21 11:17 UTC

This package is not auto-updated.

Last update: 2024-09-10 21:54:26 UTC


README

Build Status Code Quality Test Coverage Version Licence

目录

安装

composer require weew/app-twig

介绍

此包将 twig/twig 集成到 weew/app 框架中。

使用

只需在应用内核上注册 TwigProvider

$app = new App();
$app->getKernel()->addProviders([
    TwigProvider::class,
]);

示例配置

以下是在 yaml 中的配置示例

twig:
  debug: true
  charset: utf-8
  base_template_class: SomeClass
  cache: /cache/path
  auto_reload: true
  auto_escape: true
  strict_variables: false
  optimizations: -1

  paths:
    - /path/to/views
    - /another/path/to/views

  namespaces:
    namespace: /path/to/namespaced/views
    another_namespace: /another/path/to/namespaced/views

唯一必需的设置是 twig.debug,其他所有设置都是可选的,应根据需要使用。有关 twig 配置的更多信息,请参阅 twig 文档