web.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. /*
  40. 'urlManager' => [
  41. 'enablePrettyUrl' => true,
  42. 'showScriptName' => false,
  43. 'rules' => [
  44. ],
  45. ],
  46. */
  47. ],
  48. 'params' => $params,
  49. ];
  50. if (YII_ENV_DEV) {
  51. // configuration adjustments for 'dev' environment
  52. $config['bootstrap'][] = 'debug';
  53. $config['modules']['debug'] = [
  54. 'class' => 'yii\debug\Module',
  55. // uncomment the following to add your IP if you are not connecting from localhost.
  56. //'allowedIPs' => ['127.0.0.1', '::1'],
  57. ];
  58. $config['bootstrap'][] = 'gii';
  59. $config['modules']['gii'] = [
  60. 'class' => 'yii\gii\Module',
  61. // uncomment the following to add your IP if you are not connecting from localhost.
  62. //'allowedIPs' => ['127.0.0.1', '::1'],
  63. ];
  64. }
  65. return $config;