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

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

hi guys! i need some help please i just create template using twig i cannot view its showing Application error i am using latest version of slim here's my code

$app = new \Slim\App();

// Get container
$container = $app->getContainer();

// Register component on container
$container['view'] = function ($container) {
    $view = new \Slim\Views\Twig('templates', [
        'cache' => 'path/to/cache'
    $view->addExtension(new \Slim\Views\TwigExtension(

    return $view;

// Render Twig template in route
$app->get('/', function ($request, $response, $args)use($app) {
    return $this->view->render($response, 'about.twig'

I've follow the tutorial but it's out of dated the structure of code was update need to read more to come up to the latest version

Devin Gray
Devin Gray
39,261 Points

Yes, the content is outdated since slim v3 came out. Instead of using the code in the video, use the code mentioned here in the v3 update


When you change the code to follow that, it should at the very least show a different error if not work completely. Also make sure that you have your configuration settings set to display error details, and change your cache to equal false. If you can't find these settings in the link provided or it's still not working let me know...after I get my sleep because I just spent 3 hours fixing this problem and I was feeling generous about paying it forward. :)

thanks men just to remove the cache it work's fine now thank's a lot