Switch branches/tags
Find file Copy path
8a471f3 Aug 21, 2018
3 contributors

Users who have contributed to this file

@f3l1x @Gappa @vody105
100 lines (67 sloc) 2.98 KB




The ExtraConfigurator extends Configurator and adds a few methods for better usage in containers (Docker).

  • setFileDebugMode($fileName = NULL)
  • setEnvDebugMode()
  • addEnvParameters()

Debug mode

We added two methods to help you detect the debug mode. You can either manage the debug mode via NETTE_DEBUG environmental variable and detect it this way:

$configurator = new ExtraConfigurator();

or via a file. If no file is supplied as a parameter, it looks for .debug file in the root directory. The sole existence of the file with no content will set the debug mode to TRUE.

$configurator = new ExtraConfigurator();
$configurator->setFileDebugMode(__DIR__ . '/../.debug');

Valid values for the ENV variable NETTE_DEBUG and the file are:

  • true
  • 1
  • false
  • 0
  • cookie@

Environment variables

You can now setup your config parameters over environment variables.

Environment variable must follow this pattern: NETTE__{NAME}, NETTE__{NAME}__{NAME2}.

export NETTE__DATABASE__HOST=localhost

Just create your configurator object.

use Contributte\Bootstrap\ExtraConfigurator;

$configurator = new ExtraConfigurator();

That's all.


You can also use these static methods for parsing ENV variables and setting the debug mode from the ENV variable.



There's a need to organize bulk of codes together, we call them plugins. Official Nette\Configurator does not support any type of plugin, so PluggableConfigurator was created.

use Contributte\Bootstrap\PluggableConfigurator;

$pluggable = new PluggableConfigurator();

$pluggable->addPlugin(new MyBeforeContainerIsLoadedPlugin());
$pluggable->addPlugin(new SpecialOnlyInDebugModePlugin());

You can easilly add a new plugin via addPlugin($plugin) method.

There are some types of plugin.

Plugin Triggers Arguments Mode
IConfigurationPlugin before createContainer Configurator ALL
IContainerPlugin after createContainer Configurator, Container ALL
IDebugContainerPlugin after createContainer Configurator, Container DEBUG
ICompilerPlugin during generateContainer Configurator, Compiler ALL
IDebugCompilerPlugin during generateContainer Configurator, Compiler DEBUG