PHP code example of drmvc / config

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

    

drmvc / config example snippets



onfig object
$config = new \DrMVC\Config();

// Load file with array inside from filesystem
$config->load(__DIR__ . '/array.php');

// Load file from filesystem and put into array with specific key
$config->load(__DIR__ . '/array.php', 'subarray');

$config->set('param_new', 'value'); // Add new text parameter
$config->set('param_arr', [1,2,3]); // Add new array parameter

$all = $config->get();              // Get all available parameters
$one = $config->get('param_new');   // Get single parameter
$arr = $config->get('param_arr');   // Get single parameter with array