web.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $config = [
  5. 'id' => 'basic',
  6. 'basePath' => dirname(__DIR__),
  7. 'bootstrap' => ['log'],
  8. 'aliases' => [
  9. '@bower' => '@vendor/bower-asset',
  10. '@npm' => '@vendor/npm-asset',
  11. ],
  12. 'components' => [
  13. 'request' => [
  14. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  15. 'cookieValidationKey' => 'eQMzREBG6QdTA8esfmhPEUpPsmN3MDIb',
  16. ],
  17. 'cache' => [
  18. 'class' => 'yii\caching\FileCache',
  19. ],
  20. 'user' => [
  21. 'identityClass' => 'app\models\User',
  22. 'enableAutoLogin' => true,
  23. ],
  24. 'errorHandler' => [
  25. 'errorAction' => 'site/error',
  26. ],
  27. 'mailer' => [
  28. 'class' => 'yii\swiftmailer\Mailer',
  29. // send all mails to a file by default. You have to set
  30. // 'useFileTransport' to false and configure a transport
  31. // for the mailer to send real emails.
  32. 'useFileTransport' => true,
  33. ],
  34. 'log' => [
  35. 'traceLevel' => YII_DEBUG ? 3 : 0,
  36. 'targets' => [
  37. [
  38. 'class' => 'yii\log\FileTarget',
  39. 'levels' => ['error', 'warning'],
  40. ],
  41. ],
  42. ],
  43. 'db' => $db,
  44. 'urlManager' => [
  45. 'enablePrettyUrl' => true,
  46. 'showScriptName' => false,
  47. 'rules' => [
  48. ],
  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' => ['127.0.0.1', '::1'],
  66. ];
  67. }
  68. return $config;