Example #1
0
function kernel()
{
    static $kernel;
    $kernel = new Kernel();
    $configLoader = new ConfigLoader();
    $configLoader->load('framework', 'vendor/corneltek/phifty-core/config/framework.dev.yml');
    $kernel->registerService(new \Phifty\ServiceProvider\ConfigServiceProvider($configLoader));
    $kernel->registerService(new \Phifty\ServiceProvider\EventServiceProvider());
    return $kernel;
}
Example #2
0
function initConfigLoader()
{
    // We load other services from the definitions in config file
    // Simple load three config files (framework.yml, database.yml, application.yml)
    $loader = new ConfigLoader();
    if (file_exists(PH_APP_ROOT . '/config/framework.yml')) {
        $loader->load('framework', PH_APP_ROOT . '/config/framework.yml');
    }
    // This is for DatabaseService
    if (file_exists(PH_APP_ROOT . '/db/config/database.yml')) {
        $loader->load('database', PH_APP_ROOT . '/db/config/database.yml');
    } elseif (file_exists(PH_APP_ROOT . '/config/database.yml')) {
        $loader->load('database', PH_APP_ROOT . '/config/database.yml');
    }
    // Config for application, services does not depends on this config file.
    if (file_exists(PH_APP_ROOT . '/config/application.yml')) {
        $loader->load('application', PH_APP_ROOT . '/config/application.yml');
    }
    // Only load testing configuration when environment
    // is 'testing'
    if (getenv('PHIFTY_ENV') === 'testing') {
        if (file_exists(PH_APP_ROOT . '/config/testing.yml')) {
            $loader->load('testing', ConfigCompiler::compile(PH_APP_ROOT . '/config/testing.yml'));
        }
    }
    return $loader;
}