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 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}