segaja / template
This package is abandoned and no longer maintained.
No replacement package was suggested.
Small wrapper around twig/twig.
2.0.0
2019-05-17 00:00 UTC
Requires
- php: >=7.3.2
- twig/twig: ^2.7
This package is auto-updated.
Last update: 2020-05-31 21:05:15 UTC
README
installation
composer require segaja/template
Usage
<?php
$twig = new \Twig\Environment(
new \Twig\Loader\Filesystem('/path/to/templates/'),
[ /* twig options array */ ]
);
$template = new \Segaja\Template($twig);
$template->createTemplate('welcomePage');
$template->variable1 = 'Hello world';
$template->display();
This example would create twig object that reads the templates from the /path/to/templates/
directory.
The templates have to end with the .twig
suffix.
In the end the template welcomePage
is loaded, the variable1
is assigned with the value "Hello world" and the template is displayed.