web.php 1.3 KB

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