PHP code example of vi-kon / laravel-db-config

1. Go to this page and download the library: Download vi-kon/laravel-db-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/ */

    

vi-kon / laravel-db-config example snippets


// to app.php's providers array
'ViKon\DbConfig\DbConfigServiceProvider',

$value = config_db('key');

$value = config_db('key', 'default_value');

// Get value by key
$value = config_db()->get('key');

// Get value by key with default value
$value = config_db()->get('key', 'default_value');

config_db()->set('key', 'value');

// Gets 'db' group username value 
$value = config_db('db::username');
bash
php artisan vendor:publish --provider=ViKon\DbConfig\DbConfigServiceProvider

php artisan migrate