web.php 1.6 KB

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