kushal33

yii2 backend config file for different sessions

Jul 19th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1. <?php
  2. $params = array_merge(
  3.     require(__DIR__ . '/../../common/config/params.php'),
  4.     require(__DIR__ . '/../../common/config/params-local.php'),
  5.     require(__DIR__ . '/params.php'),
  6.     require(__DIR__ . '/params-local.php')
  7. );
  8.  
  9. return [
  10.     'id' => 'app-backend',
  11.     'basePath' => dirname(__DIR__),
  12.     'controllerNamespace' => 'backend\controllers',
  13.     'bootstrap' => ['log'],
  14. /*
  15.      'modules' => [
  16.     'gii' => [
  17.         'class' => 'yii\gii\Module',
  18.         'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '180.211.110.194'] // adjust this to your needs
  19.     ],
  20. ],
  21.  */  
  22.      'modules' => [
  23.         'settings' => [
  24.             'class' => 'backend\modules\settings\Settings',
  25.         ],
  26.     ],
  27.    
  28.     'components' => [
  29.  'user' => [
  30.       'identityClass' => 'backend\models\Admin',
  31.       'enableAutoLogin' => true,
  32.       'enableSession' => true,
  33.       'identityCookie' => [
  34.                 'name' => '_backendUser', // unique for backend
  35.             ],
  36.      
  37. ],
  38.          'session' => [
  39.             'name' => 'PHPBACKSESSID',
  40.             'savePath' => sys_get_temp_dir(),
  41.         ],
  42.         'request' => [
  43.             // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  44.             'cookieValidationKey' => 'qqsdfsdzgsdfgsdgsdgqq',
  45.             'csrfParam' => '_backendCSRF',
  46.         ],
  47.         'log' => [
  48.             'traceLevel' => YII_DEBUG ? 3 : 0,
  49.             'targets' => [
  50.                 [
  51.                     'class' => 'yii\log\FileTarget',
  52.                     'levels' => ['error', 'warning'],
  53.                 ],
  54.             ],
  55.         ],  
  56.         'errorHandler' => [
  57.             'errorAction' => 'site/error',
  58.         ],
  59.     ],
  60.     'params' => $params,
  61. ];
Add Comment
Please, Sign In to add comment