PHP code example of gulios / sxf-config

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

    

gulios / sxf-config example snippets


$basePath = realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR;

$configuration = new Config();
$configuration->setConfigFilesPath($basePath . 'config/');
$configuration->setEnvFile($basePath . '.env');
$configuration->setCacheConfigFile($basePath . 'cache/configuration.php');

return [
    'first_test' => env('TEST', 'defaultvalue'),
    'second_test' => [
        'key' => 'value'
    ]
];

$configuration->clearCache();
or
$configuration->createCache();

$config = new Config();
$config->setConfigFilesPath($basePath . 'config/');
$config->setEnvFile($basePath . '.env');
$config->setCacheConfigFile($basePath . 'cache/configuration.php');

$app = new Application();

$app->add(
    new ConfigCacheCommand(
        $config->getConfigFilesPath(),
        $config->getEnvFile(),
        $config->getCacheConfigFile()
    )
);
$app->add(
    new ConfigCacheClearCommand(
        $config->getConfigFilesPath(),
        $config->getEnvFile(),
        $config->getCacheConfigFile()
    )
);

$app->run();