PHP code example of laradic / config

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

    

laradic / config example snippets


"laradic/config": "1.3.*"

"Laradic\Config\ConfigServiceProvider"

use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
    protected $bootstrappers = [
        'Illuminate\Foundation\Bootstrap\DetectEnvironment',
        'Laradic\Config\Bootstrap\LoadConfiguration',
        'Illuminate\Foundation\Bootstrap\ConfigureLogging',
        'Illuminate\Foundation\Bootstrap\HandleExceptions',
        'Illuminate\Foundation\Bootstrap\RegisterFacades',
        'Illuminate\Foundation\Bootstrap\RegisterProviders',
        'Illuminate\Foundation\Bootstrap\BootProviders',
    ];
}

class YourServiceProvider extends ServiceProvider
{
    use ConfigProviderTrait;

    public function register()
    {
        $this->addConfigComponent('vendorname/packagename', 'vendorname/packagename', realpath(__DIR__.'/../resources/config'));    
    }
}

return array(
    'loader' => 'file',
    'loaders' => array(
        'file' => array(
            'save_path' => storage_path('laradic_config')
        ),
        'db' => array(
            'table' => 'config'
        )
    ),
    //.... other options
);

Config::getLoader()->set('config.item', 'value');