heydon / robo-twig
允许通过robo处理模板
dev-master
2020-12-09 22:49 UTC
Requires
- php: ^5.5.9|>=7.0.8
- consolidation/robo: ^1.2
- twig/twig: ^1.35.0
This package is auto-updated.
Last update: 2024-09-10 07:17:08 UTC
README
将twig用作robo的模板系统
用法
- 使用内存中的模板,并在屏幕上显示
$this->taskTwig()
->setTemplatesArray('index', 'Hello {{ name }}!')
->setContext('name', 'Fabien')
->applyTemplate('index', '')
->run();
- 使用模板文件并写入目标
$this->taskTwig()
->setTemplatesDirectory('./templates')
->setContext('name', 'Fabien')
->applyTemplate('index.twig', 'index.txt')
->applyTemplate('index.html.twig', 'index.html')
->run();