cvc/typo3-twig
Composer 安装命令:
composer require cvc/typo3-twig
包简介
Use the Twig template engine within your TYPO3 project.
README 文档
README
This TYPO3 extensions allows you to use the fabulous Twig template engine within your TYPO3 project.
You can use Twig templates in your Extbase controllers or in your TypoScript.
Version compatibility
The following table shows which versions of this package are compatible with which TYPO3 version.
- Version 1 is compatible to TYPO3
8.7and9.5. - Version 2 is compatible to TYPO3
10.4and11.5. - Version 3 that is developed on the
masterbranch is only compatible to TYPO3 v12
Since Version 2, PHP 7.4 is required.
| 1.x | 2.x | 3.x | |
|---|---|---|---|
| TYPO3 v12 | ❌ | ❌ | ✅ |
| TYPO3 v11 | ❌ | ✅ | ❌ |
| TYPO3 v10 | ❌ | ✅ | ❌ |
| TYPO3 v9 | ✅ | ❌ | ❌ |
| TYPO3 v8 | ✅ | ❌ | ❌ |
| PHP 8.3 | ❌ | ❌ | ✅ |
| PHP 8.2 | ❌ | ❌ | ✅ |
| PHP 8.1 | ❌ | ✅ | ✅ |
| PHP 8.0 | ❌ | ✅ | ❌ |
| PHP 7.4 | ✅ | ✅ | ❌ |
| PHP 7.3 | ✅ | ❌ | ❌ |
| PHP 7.2 | ✅ | ❌ | ❌ |
Installation
This extension only works when installed in composer mode. If you are not familiar using composer together with TYPO3 yetyou can find a how to on the TYPO3 website.
Install the extension with the following command:
composer require cvc/typo3-twig
Getting started
Rendering of Twig templates works nearly exactly the same way as rendering Fluid templates.
In contrast to Fluid there are no "layouts" nor "partials" in Twig. Everything is "just" a template. Therefore there are some features missing that you are probably used by Fluid.
Render templates in TypoScript
To render a Twig template you can use the TWIGTEMPLATE content object.
You can use it similar to the way, Fluid was used before.
The variables are rendered as content objects and data processing is also possible.
page = PAGE
page.10 = TWIGTEMPLATE
page.10 {
templateName = example.html.twig
variables {
foo = TEXT
foo.value = Bar!
}
templateRootPaths {
10 = EXT:cvc_twig/Resources/Private/TwigTemplates
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = image
}
}
}
Documentation
The full documentation is available here: cvc_twig Documentation.
Alternatives
This extension is not the first extension that supports rendering Twig templates. We decided to create our own extension, because other extensions were either not maintained anymore, they carried to much overhead or they were not developed close to the Fluid reference implementation.
In the table below you can find other extensions that provides an integration for the Twig template engine:
cvc/typo3-twig 适用场景与选型建议
cvc/typo3-twig 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.85k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2018 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cvc/typo3-twig 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cvc/typo3-twig 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2018-11-26