The Application, (or Slim\App
) is the entry point to your Slim application and is used to register the route that link to your callbacks or controllers.
The Application accepts just one argument. This can be either a Container instance or an array to configure the default container that is created automatically.
There are also a number of settings that are used by Slim. These are stored in the settings
configuration key. You can also add your application-specific settings.
For example, we can set the Slim setting displayErrorDetails
to true and also configure
Monolog like this:
As the settings are stored in the DI container so you can access them via the settings
key in container factories. For example:
You can also access them in route callables via $this
:
Slim has the following default settings that you can override:
httpVersion
'1.1'
)responseChunkSize
4096
)outputBuffering
false
, then no output buffering is enabled. If 'append'
or 'prepend'
, then any echo
or print
statements are captured and are either appended or prepended to the Response
returned from the route callable.
'append'
)determineRouteBeforeAppMiddleware
false
)displayErrorDetails
false
)addContentLengthHeader
Content-Length
header to the response.
If you are using a runtime analytics tool, such as New Relic, then this should be disabled.
true
)routerCacheFile
false
to disable the FastRoute cache system.
false
)