Код: Выделить всё
<?php
$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/db.php';
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'language' => 'ru-RU', 'defaultRoute'=>'category/index',
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'modules' => [
'admin' => [
'class' => 'app\modules\admin\Module',
'layout'=> 'admin',
'defaultRoute'=>'order/index',
],
],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
// 'cookieValidationKey' => 'OFwTWd2ye4uytMHdXAmuLG3jtikD_3zw',
'cookieValidationKey' => 'yYy4YYYX8lYyYyQOl8vOcO6ROo7i8twO',
// 'baseUrl' => '',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => false, //true когда почта реально не будет отправляться,
//если надо отправлять - устанавливаем в false и устанавливаем конфигурацию
//smtp сервера - пример есть в непереводной документации
//https://www.yiiframework.com/extension/yiisoft/yii2-swiftmailer/doc/api/2.2/yii-swiftmailer-mailer
// 'host' => 'smtp.gmail.com',
// 'username' => 'username',
// 'password' => 'password',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.mail.ru',
'username' => 'developersvil1502',
'password' => 'Tanka2905Iantra',
'port' => '465',
'encryption' => 'ssl',
],
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => $db,
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'category/<id:\d+>/page/<page:\d+>' => 'category/view',
'category/<id:\d+>' => 'category/view',
'product/<id:\d+>' => 'product/view',
'search' => 'category/search',
'cart/<id:\d+>' => 'cart/pi',
'brand/<id:\d+>' => 'brand/view',
'test/<id:\d+>/page/<page:\d+>' => 'test/page',
'test/<id:\d+>' => 'test/page',
// '' => 'site/index',
// '<controller:\w+>/<action:\w+>/' => '<controller>/<action>',
],
],
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
// uncomment the following to add your IP if you are not connecting from localhost.
//'allowedIPs' => ['127.0.0.1', '::1'],
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['*'],
// uncomment the following to add your IP if you are not connecting from localhost.
// 'allowedIPs' => ['127.0.0.1', '::1'],
];
}
return $config;