PHP code example of bupy7 / yii2-config
1. Go to this page and download the library: Download bupy7/yii2-config 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/ */
bupy7 / yii2-config example snippets
'bootstrap' => [
...
'config',
...
],
'modules' => [
'config' => [
'class' => 'bupy7\config\Module',
'enableCaching' => !YII_DEBUG,
'as access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
],
],
],
'components' => [
'configManager' => [
'class' => 'bupy7\config\components\ConfigManager',
],
],
'rules' => [
['x' => 255],
],
'options' => [
['maxlength' => true]
],
use bupy7\config\Module as ConfigModule;
...
'modules' => [
...
'config' => [
'class' => 'bupy7\config\Module',
'enableCaching' => !YII_DEBUG,
'as access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
],
'params' => [
[
'module' => 'app',
'name' => 'backendSitename',
'label' => 'PARAM_BACKEND_SITENAME',
'value' => 'Backend',
'type' => ConfigModule::TYPE_INPUT,
'language' => 'en',
'rules' => [
[' 'name' => 'displaySitename',
'label' => 'PARAM_DISPLAY_SITENAME',
'value' => '0',
'type' => ConfigModule::TYPE_YES_NO,
'language' => ConfigModule::LANGUAGE_ALL,
'rules' => [
['boolean'],
],
'hint' => 'HINT_PARAM_DISPLAY_SITENAME',
],
[
'module' => 'app',
'name' => 'supportEmail',
'label' => 'PARAM_SUPPORT_EMAIL',
'value' => '[email protected] ',
'type' => ConfigModule::TYPE_INPUT,
'language' => ConfigModule::LANGUAGE_ALL,
'rules' => [
['
Yii::$app->configManager->get('exampleModuleName', 'exampleParameterName');
Yii::$app->configManager->set('exampleModuleName', 'exampleParameterName', 'exampleParameterValue');
php composer.phar