PHP code example of phpsoftbox / config

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

    

phpsoftbox / config example snippets




declare(strict_types=1);

use PhpSoftBox\Config\Config;
$config = new Config(sources: [
    ['app' => ['name' => 'demo'], 'debug' => false],
    fn () => ['debug' => true],
]);

$name = $config->get('app.name'); // demo
$debug = $config->get('debug');   // true

$config = new ConfigFactory(environment: 'dev', baseDir: __DIR__ . '/..')->create();
bash
php psb config:encrypt "secret" --cipherKey="your-key"
php psb config:decrypt "ciphertext" --cipherKey="your-key"