Use Twig PHP template without Symfony

      No Comments on Use Twig PHP template without Symfony

How to integrate Twig PHP template into a custom php application without using Symfony framefork.   1. install Twig: mkdir test cd test composer require twig/twig 2, Create the following “test.php” file: <?php require_once(“vendor/autoload.php”); $loader = new \Twig_Loader_Filesystem(__DIR__.’/templates’); $twig = new \Twig_Environment($loader); echo $twig->render(‘demo.twig’, [‘name’ => ‘zhinyz’]); 3. create the view mkdir templates cd templates echo “Hello, {{ name }}!”… Read more »