PHP code example of kasseler / config

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

    

kasseler / config example snippets


$config = new Repository(new YamlFileReader(), new YamlFileWriter(), __DIR__.'/app/config/');

$config = new Repository(new XmlFileReader(), new XmlFileWriter(), __DIR__.'/app/config/');

$config = new Repository(new JsonFileReader(), new JsonFileWriter(), __DIR__.'/app/config/');

$config = new Repository(new ArrayFileReader(), new ArrayFileWriter(), __DIR__.'/app/config/');

$config
    ->set('database.host', 'localhost')
    ->set('database.user', 'root')
    ->set('database.password', '')
    ->set('database.database', 'config')
    ->write();
    
$config->get('database.host');