PHP code example of mougrim / yii2-container-configurator
1. Go to this page and download the library: Download mougrim/yii2-container-configurator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mougrim / yii2-container-configurator example snippets
use mougrim\yii2ContainerConfigurator\ContainerConfigurator;
use yii\di\Container;
...
Yii::$container->set(
'containerConfigurator',
function (Container $container) {
$containerConfigurator = new ContainerConfigurator($container);
$containerConfigurator->configure(
use yii\web\Response;
return [
'front.response' => [
'class' => Response::class, // class name
],
];
use yii\web\Response;
use mougrim\yii2ContainerConfigurator\ContainerConfigurator;
return [
'front.response' => [
'class' => Response::class, // class name
'type' => ContainerConfigurator::COMPONENT_TYPE_PROTOTYPE,
],
];
use yii\web\Response;
use mougrim\yii2ContainerConfigurator\ContainerConfigurator;
return [
'front.response' => [
'class' => Response::class, // class name
],
'front.response-alias' => 'front.response',
];