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

Moises Cano
Moises Cano
2,261 Points

500 Error

I'm using slim 3, and when I try to view a twig page I get, PHP Fatal error: Class 'Slim\View' not found.

2 Answers

Hussein Elhussein
PLUS
Hussein Elhussein
Courses Plus Student 2,982 Points

it is recommended to use Slim 2.6 with this course. to do so add the folllowing line to the composer.json file: "slim/slim": "^2.6", then save it and go to the console and type composer require, then enter, then also enter to download the packages inside the composer.json file using Slim 3 is a lot of hassle because it's missing the view class (which is vendor/slim/slim/slim/view.php)

devope devope
devope devope
11,490 Points

Same problem. Using MAMP.

It's my composer.json

{
    "name": "devope/treehouse-php-websites",
    "authors": [
        {
            "name": "Kirill Devope",
            "email": "mail@devope.ru"
        }
    ],
    "require": {
        "slim/slim": "~2.6",
        "twig/twig": "~1.18",
        "slim/views": "0.1.*"
    }
}