web.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. ],
  14. 'errorHandler' => [
  15. 'errorAction' => 'site/error',
  16. ],
  17. 'mail' => [
  18. 'class' => 'yii\swiftmailer\Mailer',
  19. ],
  20. 'log' => [
  21. 'traceLevel' => YII_DEBUG ? 3 : 0,
  22. 'targets' => [
  23. [
  24. 'class' => 'yii\log\FileTarget',
  25. 'levels' => ['error', 'warning'],
  26. ],
  27. ],
  28. ],
  29. 'db' => [
  30. 'class' => 'yii\db\Connection',
  31. 'dsn' => 'mysql:host=localhost;dbname=yii2basic',
  32. 'username' => 'root',
  33. 'password' => '',
  34. 'charset' => 'utf8',
  35. ],
  36. ],
  37. 'params' => $params,
  38. ];
  39. if (YII_ENV_DEV) {
  40. // configuration adjustments for 'dev' environment
  41. $config['preload'][] = 'debug';
  42. $config['modules']['debug'] = 'yii\debug\Module';
  43. $config['modules']['gii'] = 'yii\gii\Module';
  44. }
  45. if (YII_ENV_TEST) {
  46. // configuration adjustments for 'test' environment.
  47. // configuration for codeception test environments can be found in codeception folder.
  48. // if needed, customize $config here.
  49. }
  50. return $config;