web.php 1.22 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',
sensorario committed
15 16
		],
		'errorHandler' => [
Qiang Xue committed
17
			'errorAction' => 'site/error',
sensorario committed
18
		],
19 20 21
		'mail' => [
			'class' => 'yii\swiftmailer\Mailer',
		],
sensorario committed
22
		'log' => [
23
			'traceLevel' => YII_DEBUG ? 3 : 0,
sensorario committed
24 25
			'targets' => [
				[
Qiang Xue committed
26
					'class' => 'yii\log\FileTarget',
sensorario committed
27 28 29 30
					'levels' => ['error', 'warning'],
				],
			],
		],
31 32 33 34 35 36 37
		'db' => [
			'class' => 'yii\db\Connection',
			'dsn' => 'mysql:host=localhost;dbname=yii2basic',
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		],
sensorario committed
38
	],
39
	'params' => $params,
sensorario committed
40
];
41

42 43 44
if (YII_ENV_DEV)
{
	// 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';
}

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

	// if needed, customize $config here.
}

58
return $config;