I have a problem in installing Twig in my project.
when i run composer require twig
, the error appeared In ContainerBuilder.php line 1024: You have requested a non-existent service "twig".
I tried it in my other projects and it works but in this specific project it doesn't. Im new in Symfony that's is why i see this so technical.
You should use double quotes, here try this instead composer require "twig/twig:^2.0"
It seems like Flex recipe isn't always working flawlessly.
Doing composer require twig
adds only the following line to config/bundles.php
:
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
You should add another line next to it:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.