PHP code example of gaaarfild / laravel-conf

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

    

gaaarfild / laravel-conf example snippets

 PHP
'providers' => [
    // ...
    Garf\LaravelConf\LaravelConfServiceProvider::class,
]
 PHP
'aliases' => [
    // ...
  'Conf' => Garf\LaravelConf\ConfFacade::class,
]
 PHP
$config = [
    'key1' => 'value1',
    'key2.subkey' => `value2`,
];
Conf::put($config);
 PHP
Conf::forget('key');
 PHP
Conf::toJson();
 PHP
conf()->set('key.subkey', 'myValue');

conf('key.subkey') // will return 'myValue'

conf('non.existing.key', 'myDefaultValue') // will return 'myDefaultValue'

$config = [
    'key1' => 'value1',
    'key2.subkey' => `value2`,
];

conf($config)
 php
class MyStorageDriver extends Garf\LaravelConf\Drivers\AbstractDriver {
    // ...
}
Conf::extend('mystorage', function($app) {
    return $app->make('MyStorageDriver');
});