PHP code example of tinyapps / yaml-config

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

    

tinyapps / yaml-config example snippets


$config = new \TinyApps\YamlConfig\Config(__DIR__ . '/config.yml');

var_dump($config->get('your_variable')); // or
var_dump($config['your_variable']); // or
var_dump($config->your_variable);

// You can also set the config directory once for easier access
\TinyApps\YamlConfig\Config::setConfigDir(__DIR__ . '/example-configs');

$config = new Config('example'); // will read example-configs/example.yml
$config = new Config('sub/test'); // will read example-configs/sub/test.yml

TinyApps\YamlConfig\EnvLoader::init(__DIR__ . '/env.yml');
var_dump(getenv('your_environment_variable'));

TinyApps\YamlConfig\Config::getConfigValue('example', 'property'); // returns the "property" value from example config