1. Go to this page and download the library: Download yosymfony/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/ */
yosymfony / config-loader example snippets
use Yosymfony\ConfigLoader\FileLocator;
use Yosymfony\ConfigLoader\ConfigLoader;
// The file locator uses an array of pre-defined paths to find files:
$locator = new FileLocator(['/path1', '/path2']);
// Set up the ConfigLoader to work with YAML and TOML configuration files:
$config = new ConfigLoader([
new YamlLoader($locator),
new TomlLoader($locator),
]);
$config = new ConfigLoader([
new YamlLoader($locator),
]);
$config = new ConfigLoader([
new TomlLoader($locator),
]);
$config = new ConfigLoader([
new JsonLoader($locator),
]);
// Search this file in "path1" and "path2":
$config->load('user.yml');
// or load a file using its absolute path:
$config->load('/var/config/user1.yml');
// Returns the value associeted with key "name" or the default value in case not found
$repository->get('name', 'default');
// Do the same that the previous sentence but using array notation
$repository['name'];