PHP code example of sidekit / config

1. Go to this page and download the library: Download sidekit/config 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/ */

    

sidekit / config example snippets




use Da\Config\Configuration;

return [

    /*
     * --------------------------------------------------------------------------
     * Application
     * --------------------------------------------------------------------------
     *
     * Base class for all application classes. Here we configure the attributes
     * that do not hold any object configuration such as "components" or
     * "modules". The configuration of those properties are within submodules of
     * the same name.
     */

    'id' => 'application-id',

    'basePath' => Configuration::app()->getBasePath(),

    'vendorPath' => Configuration::app()->getVendorPath(),

    'runtimePath' => Configuration::app()->getRuntimePath(),

    'language' => Configuration::env()->get('APP_LANGUAGE'),

    'bootstrap' => ['log'],
];



use Da\Config\Configuration;

return [

    /*
     * --------------------------------------------------------------------------
     * Connection
     * --------------------------------------------------------------------------
     *
     * Represents a connection to a database via PDO.
     */

    'class' => 'yii\db\Connection',

    'dsn' => Configuration::env()->get('DATABASE_DSN'),

    'username' => Configuration::env()->get('DATABASE_USER'),

    'password' => Configuration::env()->get('DATABASE_PASSWORD'),

    'charset' => Configuration::env()->get('DATABASE_CHARSET'),

    'tablePrefix' => Configuration::env()->get('DATABASE_TABLE_PREFIX'),
];

env
|
└── local [ the environment name ]
    └── web [ the application which settings we need to override ]
        | 
        ├── components
        |   └── db.php  [ the component (filename) and its settings that we wish to override ]
        └── params
            └── mail.php [ the parameters to override ]
        



/*
 * --------------------------------------------------------------------------
 * Register auto loaders
 * --------------------------------------------------------------------------
 *
 * Add registered class loaders --------------------
 *
 * This step is ses to the application. Added after sidekit to take
 * advantage of its loaded configuration values
 */

script.
 */

$app = 
bash 
./vendor/bin/php-cs-fixer fix ./src --config .php_cs.dist