PHP code example of imran / laravel-dynamic-config

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

    

imran / laravel-dynamic-config example snippets


return [
    'merge_strategy' => 'deep', // deep, replace, append
    'cache_file' => base_path('bootstrap/cache/dynamic_config.php'),
    
    'sources' => [
        [
            'driver'   => 'json',
            'priority' => 5,
            'path'     => storage_path('configs/app.json'),
        ],
        [
            'driver'   => 'yaml',
            'priority' => 10,
            'path'     => storage_path('configs/features.yaml'),
        ],
        [
            'driver'   => 'database',
            'priority' => 20,
            'table'    => 'app_configs',
        ],
    ],
];

'protect_sensitive_keys' => true,
'sensitive_key_exceptions' => [
    'services.stripe.secret',
],

'protected_keys' => [
    'database.connections',
    'session',
],

use Imran\DynamicConfig\ConfigManager;

public function boot()
{
    $this->app->make(ConfigManager::class)->extend('redis', RedisDriver::class);
}
bash
php artisan vendor:publish --tag=dynamic-config-migrations
php artisan migrate
bash
php artisan dynamic-config:cache
bash
php artisan dynamic-config:clear