tomasvotruba / torch
Smoke testing of TWIG templates
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
This package is auto-updated.
Last update: 2026-06-06 01:52:08 UTC
README
...when you need to cover your Twig with smoke.
Install
composer require tomasvotruba/torch --dev
Usage
- Create
torch.phpin your project root:
use Twig\Environment; require_once __DIR__ . '/vendor/autoload.php'; // create instance of Environment with everything needed for smoke render $environment = new Environment(...); return $environment;
In this file, you can override existing twig functions:
// override twig functions you need StaticParameterProvider::set('overrideFunctions', [ // provide static value for dynamic function 'baseTemplate' => function () { return DummyTheme::LAYOUT_NAME; }, ]);
- Run torch your twig files directories:
vendor/bin/torch run templates
Behind Scenes
- 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
Happy coding!