web.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. {
  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. if (YII_ENV_TEST)
  47. {
  48. // configuration adjustments for 'test' environment.
  49. // configuration for codeception test environments can be found in codeception folder.
  50. // if needed, customize $config here.
  51. }
  52. return $config;