Do configuration magic easily in Nette!
Extension of Spaceboy\ConfigSlalom
for Nette.
Type
composer require spaceboy/nette-slalom
and that's all.
use Spaceboy\ConfigSlalom\NetteSlalom;
$configurator = NetteSlalom::run()
->when()
->serverNameIs('localhost')
->addConfig('config.local.neon')
->setDebugMode(TRUE)
->andContinue()
->when()
->serverNameIsIn(['localhost', 'farhost'])
->addConfig('config.farhost.neon')
->andContinue()
->when()
->serverNameNotMatches('^ocalhost$')
->addConfig('config.ocal.neon')
->otherwise()
->throw(new \Exception('Wrong server host.'))
->finally()
->addConfig('config.finally.neon')
->addParameters('finally', 'FOO')
->addParameters([
'finally1' => 'BAR',
'finally2' => 'BAZ',
])
->run();
$container = $configurator->createContainer();
return $container;
-
Starts new configuration slalom with existing
$configurator
. -
Provides an action.
Equal to
$configurator->addDynamicParameters($parametersArray)
. -
Provides an action.
Equal to
$configurator->addConfig($config)
. -
Provides an action.
Adds parameters to
$configurator
.When first parameter is array, sets array of parameters.
When first parameter is string, parameter array is created as
array($firstParameter => secondParameter)
.Equal to
$configurator->addParameters($parameters)
. -
Provides an action.
Adds a
$servicesArray
to$configurator
.Equal to
$configurator->addServices($servicesArray)
. -
Provides an action.
Creates robot loader.
Equal to
$configurator->createRobotLoader()
. -
Provides an action.
Adds a
$config
file to$configurator
.Equal to
$configurator->enableDebugger([$logDirectory[, $email]])
. -
Provides an action.
Enables Tracy.
Equal to
$configurator->enableTracy([$logDirectory[, $email]])
. -
Provides an action.
Sets DEBUG mode.
Equal to
$configurator->setDebugMode($mode)
.