PHP code example of aedart / config-loader

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

    

aedart / config-loader example snippets


\Aedart\Config\Loader\Providers\ConfigurationLoaderServiceProvider::class

use Aedart\Config\Loader\Loaders\ConfigLoader;

// Path to some directory that contains the configuration file(s)
$path = 'config/';

// Create a new loader instance
$loader = new ConfigLoader($path);

// Load and parse the configuration files
// NB: Is added directly to Laravel's configuration, can be accessed normally via the Config facade...
$loader->load();

// Obtain the configuration repository
$config = $loader->getConfig();


use Aedart\Config\Loader\Loaders\ConfigLoader;
use Aedart\Config\Loader\Factories\DefaultParserFactory;
use Illuminate\Config\Repository;
use Illuminate\Filesystem\Filesystem;

// Path to some directory that contains the configuration file(s)
$path = 'config/';

// Create a new loader instance
$loader = new ConfigLoader($path);

// Specify the 


// Provided you have created an instance of the configuration loader,
// simply specify the full path to the configuration file
$config = $loader->parse('config/users.yml');


return [
    'message' => 'Hallo World'
];



// ... (loading and parsing not shown) ...

// Fetch the message key
$message = $config->get('users.message');

echo $message; // Outputs 'Hallo World'