Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 4 - Not rendering Twig Template

Tags:

php

twig

symfony

When trying to render a Twig Template within a Symfony 4 project I'm getting an error. I don't know which is the problem. This is the code generating the error:

return $this->render('templates/imagenes/index.html.twig');

And this is the error I'm getting:

LogicException You can not use the "render" method if the Templating Component or the Twig Bundle are not available.

Should I install Twig via composer apart Symfony itself?

like image 381
Rola Avatar asked Jan 29 '23 01:01

Rola


1 Answers

Thanks @gogaz Installing twig did the trick.

composer require twig
like image 89
Rola Avatar answered Feb 01 '23 08:02

Rola