# Unable to add container with hello world example

**URL:** <https://discourse.slimframework.com/t/unable-to-add-container-with-hello-world-example/3415>\
**Category:** Questions\
**Created:** [September 2, 2019, 9:22pm UTC](https://discourse.slimframework.com/t/unable-to-add-container-with-hello-world-example/3415 "2019-09-02T21:22:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stymiee](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/stymiee/32/952_2.png) [@stymiee](https://discourse.slimframework.com/u/stymiee)\
**Post date:** [September 2, 2019, 9:22pm UTC](https://discourse.slimframework.com/t/unable-to-add-container-with-hello-world-example/3415/1 "2019-09-02T21:22:30Z")

</div>

I am setting up a new app using Slim 4 with PHP-DI as my dependency container. Unfortunately I receive an fatal error when attaching the container to the app.

> Warning: Cannot bind an instance to a static closure in C:\wamp64\vhosts\app\vendor\slim\slim\Slim\CallableResolver.php on line _175_  
> Fatal error: Uncaught TypeError: Return value of Slim\CallableResolver::bindToContainer() must be callable, null returned in C:\wamp64\vhosts\app\vendor\slim\slim\Slim\CallableResolver.php on line _177_  
> TypeError: Return value of Slim\CallableResolver::bindToContainer() must be callable, null returned in C:\wamp64\vhosts\app\vendor\slim\slim\Slim\CallableResolver.php on line _177_

Here is the code:

```
<?php
use DI\Container;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;

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

// Create Container using PHP-DI
$container = new Container();

// Set container to create App with on AppFactory
AppFactory::setContainer($container);
$app = AppFactory::create();

$app->get('/', static function (Request $request, Response $response, $args) {
    $response->getBody()->write('Hello world!');
    return $response;
});

$app->run();

```

When I remove `AppFactory::setContainer($container);` the error goes away an “Hello World!” is displayed as expected.

**Environment** : (WAMPserver) PHP 7.2.14, Apache 2.4.37, PHP-DI 6.0.9, Slim 4.2

I also tried PHP 7.1, Slim 4.1, and Slim 4.0. The stack trace changes slightly but the error is the same.
