I want to install and use Twig as in a module and I copied the contents of the /lib/twig/ contents to to a folder called /twig in my modules folder. I've in put require_once('twig/Autoloader.php'); at the top of my module and I use Twig_Autoloader::register() to try and get it work but as soon as I use
$this->loader = new Twig_Loader_Filesystem($path);
$this->twig = new Twig_Environment($this->loader, array(
//options
));
And I get this error: Fatal error: Class 'Twig_Loader_Filesystem' not found in
How do I resolve this?
Twig is a modern template engine for PHPSecure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design.
The Twig files are downloaded into the vendor/Twig folder. If you add other dependencies, they will also be installed in the vendor folder.
Twig is a modern, robust, OOP-based PHP templating engine. It's a tool used to output variables inside HTML, and it makes your site's frontend simpler, cleaner, dryer, and more logical. Its file and folder organization is essential, and how to use its tags, function, and filters.
Rename your twig
folder to Twig
, and then change your include:
require_once('Twig/Autoloader.php');
It should work now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With