goetas / twital-bundle

Twital 模板引擎 Symfony 扩展包

安装次数: 6,282

依赖者: 0

推荐者: 0

安全: 0

星标: 19

关注者: 3

分支: 6

公开问题: 2

类型:symfony-bundle

1.6.0 2024-05-02 16:38 UTC

This package is auto-updated.

Last update: 2024-09-02 17:17:44 UTC


README

Build Status Scrutinizer Quality Score Code Coverage GitHub license Packagist

TwitalBundle (Twital with Symfony)

TwitalBundle 是一个将 Symfony 模板引擎集成到 Synfony2 框架中的 Twital 模板引擎扩展包。这允许你使用 Twital 模板引擎语言语法来使用所有 Twig/Symfony 功能。

要了解更多关于 Twital 的信息,你可以阅读专用文档

安装

推荐使用 Composer 安装 TwitalBundle。

composer require 'goetas/twital-bundle'

如果你使用 Symfony Flex,该扩展包将被自动启用和配置,否则请按照以下步骤操作。

启用扩展包

要在内核中启用扩展包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Goetas\TwitalBundle\GoetasTwitalBundle(),
        //..
    );
}

配置

为了让其正常工作,你需要在 config.yml 中启用 twital 模板引擎。

framework:
    templating:
        engines: ['twig', 'twital']
        
#optional configurations for file extension matching 
goetas_twital:
    source_adapter:
        - { service: twital.source_adapter.xml, pattern: ['/\.xml\.twital$/', '/\.atom\.twital$/'] }
        - { service: twital.source_adapter.html5, pattern: ['/\.html\.twital$/', '/\.htm\.twital$/'] }
        - { service: twital.source_adapter.xhtml, pattern: ['/\.xhtml\.twital$/'] }    

文档

访问http://twitalbundle.readthedocs.org/ 了解 TwitalBundle 的更详细文档。

集成

TwitalBundle 包含了 TwigBundle 已经支持的 所有功能(表单、翻译、Assetic、路由等)。