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 Including & Rendering

Debashis Pati
Debashis Pati
3,864 Points

Getting "Slim Application Error A website error has occurred. Sorry for the temporary inconvenience."

I am using slim 3.0

Here is my source code


require 'vendor/autoload.php';


//use Monolog\Logger; //use Monolog\Handler\StreamHandler; //$log = new Logger('name'); //$log->pushHandler(new StreamHandler('app.txt', Logger::WARNING)); //$log->addWarning('Foo');

$app = new \Slim\App();

$app->get('/', function() use($app) { $app->render('index.html'); });

$app->get('/contact', function($request, $response, $args) { echo 'Feel free to contact us'; });



Please suggest me

Darrell Conklin
Darrell Conklin
22,096 Points

If you followed along with the teacher when he installed slim using composer then you are no doubt using a different version of Slim then the teacher since it has been updated.

In order to follow along with this video I recommend switching to the 2.6.3 version. Simply go your composer.json file and and change the version of slim to:

"require": {
        "monolog/monolog": "^1.22",
        "slim/slim": "2.6.3"

Then open your console and type

composer update

That should update slim to a similar version of what the teacher is using.

You should now be able to follow along with the teacher.