web.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. $params = require(__DIR__ . '/params.php');
  3. $config = [
  4. 'id' => 'basic',
  5. 'basePath' => dirname(__DIR__),
  6. 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
  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. 'mail' => [
  19. 'class' => 'yii\swiftmailer\Mailer',
  20. ],
  21. 'log' => [
  22. 'traceLevel' => YII_DEBUG ? 3 : 0,
  23. 'targets' => [
  24. [
  25. 'class' => 'yii\log\FileTarget',
  26. 'levels' => ['error', 'warning'],
  27. ],
  28. ],
  29. ],
  30. 'db' => [
  31. 'class' => 'yii\db\Connection',
  32. 'dsn' => 'mysql:host=localhost;dbname=yii2basic',
  33. 'username' => 'root',
  34. 'password' => '',
  35. 'charset' => 'utf8',
  36. ],
  37. ],
  38. 'params' => $params,
  39. ];
  40. if (YII_ENV_DEV) {
  41. // configuration adjustments for 'dev' environment
  42. $config['preload'][] = 'debug';
  43. $config['modules']['debug'] = 'yii\debug\Module';
  44. $config['modules']['gii'] = 'yii\gii\Module';
  45. }
  46. return $config;