web.php 1.25 KB
Newer Older
Qiang Xue committed
1
<?php
2

3
$params = require(__DIR__ . '/params.php');
4

sensorario committed
5
$config = [
6
	'id' => 'basic',
Qiang Xue committed
7
	'basePath' => dirname(__DIR__),
8
	'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
sensorario committed
9 10
	'components' => [
		'cache' => [
Qiang Xue committed
11
			'class' => 'yii\caching\FileCache',
sensorario committed
12 13
		],
		'user' => [
Qiang Xue committed
14
			'identityClass' => 'app\models\User',
15
			'enableAutoLogin' => true,
sensorario committed
16 17
		],
		'errorHandler' => [
Qiang Xue committed
18
			'errorAction' => 'site/error',
sensorario committed
19
		],
20 21 22
		'mail' => [
			'class' => 'yii\swiftmailer\Mailer',
		],
sensorario committed
23
		'log' => [
24
			'traceLevel' => YII_DEBUG ? 3 : 0,
sensorario committed
25 26
			'targets' => [
				[
Qiang Xue committed
27
					'class' => 'yii\log\FileTarget',
sensorario committed
28 29 30 31
					'levels' => ['error', 'warning'],
				],
			],
		],
32 33 34 35 36 37 38
		'db' => [
			'class' => 'yii\db\Connection',
			'dsn' => 'mysql:host=localhost;dbname=yii2basic',
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		],
sensorario committed
39
	],
40
	'params' => $params,
sensorario committed
41
];
42

Qiang Xue committed
43
if (YII_ENV_DEV) {
44
	// configuration adjustments for 'dev' environment
45 46 47 48 49
	$config['preload'][] = 'debug';
	$config['modules']['debug'] = 'yii\debug\Module';
	$config['modules']['gii'] = 'yii\gii\Module';
}

Qiang Xue committed
50
if (YII_ENV_TEST) {
51 52 53 54 55 56
	// configuration adjustments for 'test' environment.
	// configuration for codeception test environments can be found in codeception folder.

	// if needed, customize $config here.
}

57
return $config;