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 Build a REST API with PHP CRUD API in Slim Accessing Data

Christian Bastiaansen
Christian Bastiaansen
1,583 Points

Slim Application Error

After following all the steps and check and re-check my code I still have an error for which I can't fint the solution yet. Anyone having the same issue?

Slim Application Error

The application could not run because of the following error: Details Type: Slim\Exception\ContainerValueNotFoundException Message: Identifier "course" is not defined. File: /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/Container.php Line: 120 Trace

0 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/Container.php(172): Slim\Container->get('course')

1 /Users/Christian 1/php_rest_api/src/routes.php(11): Slim\Container->__get('course')

2 [internal function]: Closure->{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

3 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

4 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

5 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))

6 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))

7 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))

8 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))

9 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/App.php(405): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))

10 /Users/Christian 1/php_rest_api/vendor/slim/slim/Slim/App.php(313): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))

11 /Users/Christian 1/php_rest_api/public/index.php(33): Slim\App->run()

12 {main}