PHP code example of lav45 / yii2-project-configuration

1. Go to this page and download the library: Download lav45/yii2-project-configuration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lav45 / yii2-project-configuration example snippets


// Yii::setAlias('@app_config_path', __DIR__ . '/settings');

$db_name = config('db_name', 'site-db-name');
$db_host = config('db_host', 'localhost');

return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => "mysql:host={$db_host};dbname={$db_name}",
            'username' => config('db_username', 'root'),
            'password' => config('db_password', '****'),
            'enableSchemaCache' => true,
            'charset' => 'utf8',
        ],
    ]
];

return [
    'controllerMap' => [
        'config' => 'lav45\projectConfiguration\console\controllers\ConfigController'
    ]
];