tomasvotruba / torch
Smoke testing of TWIG templates
Installs: 6 264
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
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-10-29 19:53:53 UTC
README
...when you need to cover your Twig with smoke.
Install
composer require tomasvotruba/torch --dev
Usage
- Create
torch.php
in 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!