Twig-Helper-for-simple-mvc-framework
The helper makes Twig template engine available for Simple MVC Framework
(simplemvcframework.com).
USAGE
Note:
This section is probably going to be modified
as soon as the new implementation of ADD-ONS will be available in SMVC Framework.
The above instructions are related to #simple-mvc-framework/framework as it is issued today, 2015.11.03.
The purpose has been to implement an easily replacement for
View::render($path, $data) with
Twig::render($path, $data, $extension) .
The default extension defined in helper for templates is
.tpl. $extension may be skipped from the above syntax,
as the used templates extension is .tpl
Step1: Install twig via composer - open cmd or a terminal window, point to your smvc installation folder and then type
composer require twig/twig
Step2: copy Twig.php to app/Helpers
Step3: in a controller you wish to use Twig with:
1. type: use helpers\Twig; (preferably at the beginning of file)
2. replace View::render(...) with Twig::render(...)
Step4: learn Twig syntax and have fun ;)