web.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $routes = require __DIR__ . '/routes.php';
  5. $config = [
  6. 'id' => 'basic',
  7. 'basePath' => dirname(__DIR__),
  8. 'bootstrap' => ['log'],
  9. 'aliases' => [
  10. '@bower' => '@vendor/bower-asset',
  11. '@npm' => '@vendor/npm-asset',
  12. ],
  13. 'components' => [
  14. 'request' => [
  15. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  16. 'cookieValidationKey' => 'WyEyjj5Lk_8A5msMn1mn5-UQN_xDaNsc',
  17. ],
  18. 'cache' => [
  19. 'class' => 'yii\caching\FileCache',
  20. ],
  21. 'user' => [
  22. 'identityClass' => 'app\models\User',
  23. 'enableAutoLogin' => true,
  24. ],
  25. 'errorHandler' => [
  26. 'errorAction' => 'site/error',
  27. ],
  28. 'mailer' => [
  29. 'class' => 'yii\swiftmailer\Mailer',
  30. // send all mails to a file by default. You have to set
  31. // 'useFileTransport' to false and configure transport
  32. // for the mailer to send real emails.
  33. 'useFileTransport' => true,
  34. ],
  35. 'log' => [
  36. 'traceLevel' => YII_DEBUG ? 3 : 0,
  37. 'targets' => [
  38. [
  39. 'class' => 'yii\log\FileTarget',
  40. 'levels' => ['error', 'warning'],
  41. ],
  42. ],
  43. ],
  44. 'db' => $db,
  45. 'urlManager' => [
  46. 'enablePrettyUrl' => true,
  47. 'showScriptName' => false,
  48. 'rules' =>$routes,
  49. ],
  50. ],
  51. 'params' => $params,
  52. ];
  53. if (YII_ENV_DEV) {
  54. // configuration adjustments for 'dev' environment
  55. $config['bootstrap'][] = 'debug';
  56. $config['modules']['debug'] = [
  57. 'class' => 'yii\debug\Module',
  58. // uncomment the following to add your IP if you are not connecting from localhost.
  59. //'allowedIPs' => ['127.0.0.1', '::1'],
  60. ];
  61. $config['bootstrap'][] = 'gii';
  62. $config['modules']['gii'] = [
  63. 'class' => 'yii\gii\Module',
  64. // uncomment the following to add your IP if you are not connecting from localhost.
  65. 'allowedIPs' => ['*'],
  66. ];
  67. }
  68. return $config;