Closed francoisnza closed 4 years ago
whoa! I get the same error, and I went here and thats work. I think this is for a Pull Request to tutorial
sorry, PR had done: https://github.com/PatrickLouys/no-framework-tutorial/pull/69
Checking in May 2021 with the same error at the same step and this solution worked!
Thank you for the tutorial Patrick,
Working through part: 11-page-menu of the tutorial Twig throws an exception (see below), I'm sure I did everything right; IMHO 'as a student of PHP' this is a result of changes long after you published this and an update to the content might be required. I'll let you be the judge of that.
LogicException: You must set a loader first. at Line 819 in /var/www/vendor/twig/twig/src/Environment.php
My composer.json uses "twig/twig": "~1.0" which installed version "1.42-dev"
I found https://github.com/twigphp/Twig/issues/2907 that helped me to get it working by:
Changing Dependencies.php for Twig from $injector->delegate('Twig_Environment', function () use ($injector) { to $injector->delegate('\Twig\Environment', function () use ($injector) {
and changing the constructor in TwigRenderer.php from public function __construct(Twig_Environment $renderer) to public function __construct(\Twig\Environment $renderer)
Thanks again for the great tutorial!