コード例 #1
0
/**
 * Checking environment
 *
 * The environment is already loaded, now it should be checked
 */
$dotenv->required(['APP_ROOT', 'APP_CONFIG', 'WKHTMLTOPDF']);
/**
 * Setting up dependency container
 */
$diConfig = (require __DIR__ . '/di.php');
$container = new Container($diConfig);
/**
 * Instantiating the application
 */
$app = new Application();
$app->setContainer($container);
$app['env'] = $dotenv;
/**
 * Loading configuration
 */
if (is_file($configFile = getenv('APP_CONFIG'))) {
    foreach (Yaml::parse($configFile) as $config => $value) {
        $app->setConfig($config, $value);
    }
}
// The application path is protected from being overwritten
// Should be placed after configuration loading
$app->setConfig('path', __DIR__);
// Set locale based on environment
setlocale(LC_ALL, getenv('LANG'));
$bootstrap = new Bootstrap();