heydon / robo-twig
Allow the processing of templates via robo
Installs: 29 008
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:robo-tasks
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-12-10 07:48:17 UTC
README
Use twig as a templating system system for robo
Usage
- Use with template in memory, and displaying to the screen
$this->taskTwig()
->setTemplatesArray('index', 'Hello {{ name }}!')
->setContext('name', 'Fabien')
->applyTemplate('index', '')
->run();
- Use with template file and write to destination
$this->taskTwig()
->setTemplatesDirectory('./templates')
->setContext('name', 'Fabien')
->applyTemplate('index.twig', 'index.txt')
->applyTemplate('index.html.twig', 'index.html')
->run();