X
X
XEHKOK2017-02-05 17:00:47
PHP
XEHKOK, 2017-02-05 17:00:47

Switching from Twig 1.x to Twig 2.x in Source code style?

Good day to all. My web server config Apache/2.4.25 (Unix) PHP/7.1.0 PostgreSQL(libpq) Version 9.5.5 So I decided to continue my project and wanted to upgrade Twig 1.x to Twig 2.x in Source code style. Of the 3 available installation methods, I chose Installing from the tarball release.
An example of my Twig connection

$tpl_path = ROOT_DIR . '/templates/' . $config['cp_tpl'];

require_once ENGINE_DIR . '/lib/Twig/Autoloader.php';
Twig_Autoloader::register();

$loader = new Twig_Loader_Filesystem($tpl_path);
$twig = new Twig_Environment($loader, array(
    'cache'       => ENGINE_DIR . '/cache/twig',
    'auto_reload' => true
));

Fatal error: Uncaught Error: Class 'Twig_Loader_Filesystem' not found in /var/www/htdocs/engine/init.php:9 Stack trace: #0 /var/www/htdocs/index.php(6): require_once() #1 {main} thrown in /var/www/htdocs/engine/init.php on line 9

I understand that there is no /lib/Twig/Autoloader.php in the new version, and I read the CHANGELOG.
Composer is a wild thing for me, I don't want to use it because I have the entire configure server :). Please help me install Twig 2.x using Source code, Help me???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Gruzdev, 2017-02-06
@egor_gruzdev

PSR-0: Autoloading Standard - PHP-FIG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question