mitukiti11 / twig_ob_compiler
twig output buffer compiler.
0.1.2
2018-09-23 11:27 UTC
Requires
- php: ^7.0
- twig/twig: ^2.5
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: 6.5.*
This package is auto-updated.
Last update: 2025-03-29 00:44:15 UTC
README
twig output buffer compiler
# install
composer install mitukiti11/twig_ob_compiler
index.php
use Mitts11\Twig\TwigObCompiler; // require ("./vendor/autoload.php"); // Please load in your way /** @var $twig Twig_Environment */ $twig = $container->get('twig'); // set TwigObCompiler $twig->setCompiler(new TwigObCompiler($twig)); // render $twig->display('index.html.twig', array('sleeping' => new class { public function __toString () { sleep(1); return "wake!!!"; } }));
index.html.twig
<pre> 1{{ sleeping }} 2{{ sleeping }} 3{{ sleeping }} 4{{ sleeping }} 5{{ sleeping }} 6{{ sleeping }} 7{{ sleeping }} 8{{ sleeping }} 9{{ sleeping }} 10{{ sleeping }} complete!!! </pre>