PHP code example of gacela-project / gacela-env-config-reader

1. Go to this page and download the library: Download gacela-project/gacela-env-config-reader 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/ */

    

gacela-project / gacela-env-config-reader example snippets


 # gacela.php

use Gacela\Framework\Bootstrap\GacelaConfig;
use Gacela\Framework\Config\ConfigReader\EnvConfigReader;

return static function (GacelaConfig $config): void {
    $config->addAppConfig('config/.env*', 'config/.env.local.dist', EnvConfigReader::class);
};

  # public/index.php

use Gacela\Framework\Bootstrap\GacelaConfig;
use Gacela\Framework\Config\ConfigReader\EnvConfigReader;
use Gacela\Framework\Gacela;

$config = static function (GacelaConfig $config): void {
    $config->addAppConfig('config/.env*', 'config/.env.local.dist', EnvConfigReader::class);
};

Gacela::bootstrap($appRootDir, $config);

$config = static function (GacelaConfig $config): void {
    $config->addAppConfig('config/.env*', 'config/.env.local.dist', EnvConfigReader::class);
    $config->addAppConfig('config/*.php', 'config/local.php');
    $config->addAppConfig('config/*.custom', '', CustomConfigReader::class);
}