PHP code example of mediadevs / configuration

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

    

mediadevs / configuration example snippets




use Mediadevs\Configuration\Configuration;
use \Mediadevs\Configuration\Exceptions\ConfigurationFileException;
use \Mediadevs\Configuration\Exceptions\InvalidReturnTypeException;
use \Mediadevs\Configuration\Exceptions\ConfigurationDirectoryException;

try {
    $config = (new Configuration())
        ->directory('./config')
        ->config('config_file')
        ->get(Configuration::RETURN_TYPE_ARRAY);
    /**
     * Possible return types:
     * array:   (Configuration::RETURN_TYPE_ARRAY)
     * Json:    (Configuration::RETURN_TYPE_JSON)
     */
} catch (ConfigurationDirectoryException $e) {
    echo $e->errorMessage();
} catch (ConfigurationFileException $e) {
    echo $e->errorMessage();
} catch (InvalidReturnTypeException $e) {
    echo $e->errorMessage();
}