PHP code example of quillstack / config

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

    

quillstack / config example snippets


use Quillstack\Config\Config;

final class AwsConfig extends Config
{
    protected array $config = [
        'region' => 'eu-central-1',
        'token' => [
            'current' => 'abc',
            'previous' => 'xyz',
        ],
    ];
}

use Quillstack\Config\ConfigProviderInterface;

final class ConfigProvider implements ConfigProviderInterface
{
    public function load(): array
    {
        return [
            'aws' => AwsConfig::class,
            'mail' => MailConfig::class,
        ];
    }
}

$configuration->get('aws.region');            // 'eu-central-1'
$configuration->get('aws.token.current');     // 'abc'
$configuration->get('aws.token.missing');     // null
$configuration->get('aws.retries', 3);        // 3 — nothing there, so the default
$configuration->get('nothing.at.all', 'x');   // 'x' — no such class either