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 trialitangsanjana
2,685 PointsI just in to PHP :) I'll try both. Thanks!
Mattea Turnbull
4,134 Pointsthanks - wasn't sure what was wrong.. Antonio's code below works.
2 Answers
Alexander Sobakar
10,044 PointsNew code is:
<?php
require 'vendor/autoload.php';
$app = new \Slim\App();
$app->get('/hello/{name}', function($req, $rsp, $args ){
echo "Hello {$args['name']}";
});
$app->run();
Bryn Humphreys
26,472 PointsThank you!
Sarah Rose
6,918 PointsAmazing, thank you Alexander
David Pennington
15,713 PointsI installed Slim 3 also and found that the syntax is significantly different from that of version 2. In order to follow on with the video, this is what I did in workspaces to remove v3 and install version 2:
treehouse:~/workspace$ composer remove slim/slim
treehouse:~/workspace$ composer update
treehouse:~/workspace$ composer require slim/slim:~2.0
You can find The Slim version 2 docs as shown on the video here.
Antonio Jaramillo
15,604 PointsAntonio Jaramillo
15,604 PointsYou probably have already figured this out, but I merely included the new required code:
Everything else in this video works exactly the same.