tommasvotruba / torch
对TWIG模板进行烟雾测试
0.3.9
2024-01-29 18:09 UTC
Requires
- php: ^8.1
- illuminate/container: ^10.42
- nette/utils: ^3.0|^4.0
- symfony/console: ^6.0|^7.0
- symfony/finder: ^6.0|^7.0
- symfony/twig-bridge: ^6.0|^7.0
- twig/twig: ^2.0|^3.0
- webmozart/assert: ^1.11
Requires (Dev)
- phpstan/phpstan: ^1.10.57
- phpunit/phpunit: ^10.5
- rector/rector: dev-main
- symplify/easy-coding-standard: ^12.0
- tomasvotruba/class-leak: ^0.2
- tracy/tracy: ^2.10
- dev-main
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.22.72
- 0.2.22
- 0.2.21.72
- 0.2.21
- 0.2.20.72
- 0.2.20
- 0.2.19.72
- 0.2.19
- 0.2.18.72
- 0.2.18
- 0.2.17.72
- 0.2.17
- 0.2.16.72
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12.72
- 0.2.12
- 0.2.11.72
- 0.2.11
- 0.2.10.72
- 0.2.10
- 0.2.9.72
- 0.2.9
- 0.2.8.72
- 0.2.8
- 0.2.7.72
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.0
This package is auto-updated.
Last update: 2024-08-29 19:34:23 UTC
README
...当你需要给你的Twig覆盖烟雾时。
安装
composer require tomasvotruba/torch --dev
用法
- 在你的项目根目录创建
torch.php
use Twig\Environment; require_once __DIR__ . '/vendor/autoload.php'; // create instance of Environment with everything needed for smoke render $environment = new Environment(...); return $environment;
在这个文件中,你可以覆盖现有的twig函数
// override twig functions you need StaticParameterProvider::set('overrideFunctions', [ // provide static value for dynamic function 'baseTemplate' => function () { return DummyTheme::LAYOUT_NAME; }, ]);
- 运行torch命令在你的twig文件目录中
vendor/bin/torch run templates
幕后
- https://tomasvotruba.com/blog/twig-smoke-rendering-why-do-we-even-need-it/
- https://tomasvotruba.com/blog/twig-smoke-rendering-journey-of-fails/
- https://tomasvotruba.com/blog/twig-smoke-rendering-fortune-favors-the-bold
快乐编码!