I'm getting:
Fatal error: Class 'Twig_Loader_Filesystem'
<?php
require_once "library/Symfony/Component/ClassLoader/UniversalClassLoader.php";
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace("Symfony\Component", "library/Symfony/Component");
$loader->registerPrefix("Twig_", "library/Twig");
$loader->register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
'cache' => '',
));
?>
The Twig folder is in library folder. Have I missunderstood on how to use the component?
__DIR__ . '/library'
DebugUniversalClassLoader
to pin down the problem - you can catch a RuntimeException
and see which file it actually tries to load.EDIT:
Correct solution: If you try to load PEAR-style classes with prefix Twig_
from '/library/Twig'
, you should point it to '/library'
, because Twig_
prefix itself will be used as a directory name inside /library