Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Layouts with Twig

After installing Twig, I got this error.

I got this error.

Warning: Missing argument 1 for Slim\Views\Twig::__construct(), called in C:\xampp\htdocs\index.php on line 7 and defined in C:\xampp\vendor\slim\twig-view\src\Twig.php on line 56

Notice: Undefined variable: path in C:\xampp\vendor\slim\twig-view\src\Twig.php on line 58

Notice: Undefined variable: path in C:\xampp\vendor\slim\twig-view\src\Twig.php on line 60

Catchable fatal error: Argument 1 passed to Slim\Views\Twig::addPaths() must be of the type array, null given, called in C:\xampp\vendor\slim\twig-view\src\Twig.php on line 60 and defined in C:\xampp\vendor\slim\twig-view\src\Twig.php on line 116

Please help me. I am using the same version of Slim and twig as the teacher.

3 Answers

I got this exact same error today. I don't have a fix but if anyone knows what to do I'd appreciate it!

Alex Flores
Alex Flores
7,864 Points

Same... and there's like no documentation on it.

Patryk Łaba
Patryk Łaba
6,750 Points

I have the same issue. Have anyone solved it?

Alex Flores
Alex Flores
7,864 Points

They're using an old version of Slim. Check to see what version of Slim you're using, it's likely 3+, which has a different installation.