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. "defaultRoute"=>"index",
  13. 'components' => [
  14. 'request' => [
  15. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  16. 'cookieValidationKey' => 'W8-6bJ5sPMgMQXTw5wMH-M5lxZwnT48H',
  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 a 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. 'enableStrictParsing'=>false,
  49. 'rules' => [
  50. ],
  51. ],
  52. ],
  53. 'params' => $params,
  54. ];
  55. if (YII_ENV_DEV) {
  56. // configuration adjustments for 'dev' environment
  57. $config['bootstrap'][] = 'debug';
  58. $config['modules']['debug'] = [
  59. 'class' => 'yii\debug\Module',
  60. // uncomment the following to add your IP if you are not connecting from localhost.
  61. //'allowedIPs' => ['127.0.0.1', '::1'],
  62. ];
  63. $config['bootstrap'][] = 'gii';
  64. $config['modules']['gii'] = [
  65. 'class' => 'yii\gii\Module',
  66. // uncomment the following to add your IP if you are not connecting from localhost.
  67. //'allowedIPs' => ['127.0.0.1', '::1'],
  68. ];
  69. }
  70. return $config;