Trying to set error details true


I am probably going to feel dumb when someone comments on this but here goes:
I just started experimenting with slim for an upcoming project and wanted to get some good error output - like stack traces while I make newbee mistakes. So from the online docs I tried

$configuration = [
‘settings’ => [
‘displayErrorDetails’ => true,
$c = new \Slim\Container($configuration);
$app = new \Slim\App($c);

But this throws an error since the Slim\App class constructor requires an array not a Slim\Container as its single argument.

So whats going - am I reading the wrong docs ?

So I tried passing the array $configuration to the Slim\App constructor, no joy still cryptic error messages.

If I hack the two error handlers to make the test

if ($this->displayErrorDetails || true)

I get useful error output. So I am on the right track with trying to configure the error handlers - but without more digging through the Slim dont know where in the config process I should change the displayErrorDetails flag.

Suggestions gratefully accepted


An update :

$configuration = [
‘settings’ => [
‘displayErrorDetails’ => true,
$app = new \Slim\App($configuration[‘settings’]);

this is the config code that actually succeeds in turning on error details.

The other interesting thing I found by following the code through is that although ErrorHandle and phpErrorHandler are registered with the container they are never used from the container.

Slim\App creates instances of these two error handlers by itself and references the class name directly in doing so.

My guess is that the code is partway through a conversion to using the Container more widely and the active code for creating error handlers is still the “old stuff”.


The app does not accept only an array. It’s a default value. As you can see you may pass a Container.

The errorHandler and phpErrorHandler are bind in the container here.


Interesting - the Slim code I have installed does not look like your link. It looks like this:

Seems to be a difference between the 3.x and 4.x branch. I tried to install 3.x with composer but got conflict errors so used 4.x.


Please use 3.X instead, the 4 is a work in progress at the moment.