Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Building Websites with PHP Slim Basics & Twig Templates Routing For Our Project

Ulrike Pechmann
Ulrike Pechmann
18,211 Points

My Solution with Slim 3.8

I tried to make it in Slim 3.8.x so here is the Code that works for me.

2 Answers

Rob Adams
Rob Adams
3,460 Points

May 2018 - Slim v3.10

Here's the code I was able to get to work for this video. It's a combination of Hampton's 'require' and 'date/time' fix and the code on the front page of the Slim site. Good luck! (This video really does need an update.)

  require __DIR__ . '/vendor/autoload.php';

  use \Psr\Http\Message\ServerRequestInterface as Request;
  use \Psr\Http\Message\ResponseInterface as Response;

  $app = new \Slim\App;
  $app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");

    return $response;