web.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. $params = require __DIR__ . '/params.php';
  3. $db = require __DIR__ . '/db.php';
  4. $config = [
  5. 'id' => 'basic',
  6. 'basePath' => dirname(__DIR__),
  7. 'bootstrap' => ['log'],
  8. 'aliases' => [
  9. '@bower' => '@vendor/bower-asset',
  10. '@npm' => '@vendor/npm-asset',
  11. ],
  12. 'components' => [
  13. 'request' => [
  14. 'parsers' => [
  15. 'application/json' => 'yii\web\JsonParser',
  16. ],
  17. 'enableCsrfValidation' => false,
  18. // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
  19. 'cookieValidationKey' => 'P9HfAQYdIti-m1CVE6LXzfZd6p6adKk7',
  20. 'baseUrl'=> '/api/',
  21. ],
  22. 'response' => [
  23. //'format' => yii\web\Response::FORMAT_JSON,
  24. 'charset' => 'UTF-8',
  25. ],
  26. 'cache' => [
  27. 'class' => 'yii\caching\FileCache',
  28. ],
  29. 'user' => [
  30. 'identityClass' => 'app\models\User',
  31. 'enableAutoLogin' => true,
  32. ],
  33. 'errorHandler' => [
  34. 'errorAction' => 'site/error',
  35. ],
  36. 'mailer' => [
  37. 'class' => 'yii\swiftmailer\Mailer',
  38. // send all mails to a file by default. You have to set
  39. // 'useFileTransport' to false and configure a transport
  40. // for the mailer to send real emails.
  41. 'useFileTransport' => true,
  42. ],
  43. 'log' => [
  44. 'traceLevel' => YII_DEBUG ? 3 : 0,
  45. 'targets' => [
  46. [
  47. 'class' => 'yii\log\FileTarget',
  48. 'levels' => ['error', 'warning'],
  49. ],
  50. ],
  51. ],
  52. 'doctrine' => [
  53. 'class' => Infinitiweb\YiiDoctrine\Component::class,
  54. 'dbal' => [
  55. //'url' => 'pdo_mysql://Denis:123@localhost/promsystem'
  56. 'driver' => 'pdo_mysql',
  57. 'user' => 'Denis',
  58. 'password' => '123',
  59. 'dbname' => 'promsystem',
  60. ],
  61. 'myparams' =>[
  62. //'url' => 'pdo_mysql://Denis:123@localhost/promsystem'
  63. 'driver' => 'pdo_mysql',
  64. 'user' => 'Denis',
  65. 'password' => '123',
  66. 'dbname' => 'promsystem',
  67. ],
  68. 'entityPath' => [
  69. '@app/entity'
  70. ]
  71. ],
  72. 'db' => $db,
  73. 'urlManager' => [
  74. 'enablePrettyUrl' => true,
  75. 'showScriptName' => false,
  76. 'rules' => [
  77. '<controller>/<action>' => '<controller>/<action>'
  78. ],
  79. ],
  80. ],
  81. 'modules' => [
  82. 'api' => [
  83. 'class' => 'app\modules\Module',
  84. ],
  85. ],
  86. 'params' => $params,
  87. ];
  88. if (YII_ENV_DEV) {
  89. // configuration adjustments for 'dev' environment
  90. $config['bootstrap'][] = 'debug';
  91. $config['modules']['debug'] = [
  92. 'class' => 'yii\debug\Module',
  93. // uncomment the following to add your IP if you are not connecting from localhost.
  94. //'allowedIPs' => ['127.0.0.1', '::1'],
  95. ];
  96. $config['bootstrap'][] = 'gii';
  97. $config['modules']['gii'] = [
  98. 'class' => 'yii\gii\Module',
  99. // uncomment the following to add your IP if you are not connecting from localhost.
  100. //'allowedIPs' => ['127.0.0.1', '::1'],
  101. ];
  102. }
  103. return $config;