// Config $config = array('debug' => true, 'locale' => 'en', 'baseUrl' => '', 'theme' => 'yeti', 'requireHttps' => false, 'timer.start' => $startTime, 'monolog.name' => 'pwx', 'monolog.level' => \Monolog\Logger::DEBUG, 'monolog.logfile' => __DIR__ . '/../log/app.log', 'twig.path' => __DIR__ . '/../src/App/views', 'twig.options' => array('cache' => __DIR__ . '/../cache/twig'), 'orm.em.options' => array('mappings' => array(array('type' => 'annotation', 'namespace' => 'App\\Entity', 'path' => __DIR__ . '/../src/App/Entity')))); if (file_exists(__DIR__ . '/config.php')) { include __DIR__ . '/config.php'; } // Initialize Silex $app = new App\Silex\Application($config); // Register ControllerServiceProvider service $app->register(new Silex\Provider\ServiceControllerServiceProvider()); // Register DoctrineServiceProvider service $app->register(new Silex\Provider\DoctrineServiceProvider(), $config); // Register DoctrineOrmServiceProvider service $app->register(new Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider(), $config); // Register theme service & set user theme $app['i18n_service'] = $app->share(function () { return new App\Service\I18nService(); }); // Register translation service $app->register(new Silex\Provider\TranslationServiceProvider(), array('locale_fallbacks' => array('en'), 'locale' => $app['i18n_service']->getLocale($config['locale']))); // Register the yaml translations $app['translator'] = $app->share($app->extend('translator', function (Silex\Translator $translator, $app) { $translator->addLoader('yaml', new Symfony\Component\Translation\Loader\YamlFileLoader()); foreach ($app['i18n_service']->getValidLocales() as $locale) { $translator->addResource('yaml', __DIR__ . '/locales/' . $locale . '.yml', $locale); } return $translator; })); // Register Credentials factory $app['credentials_factory'] = $app->share(function () { return new App\Factory\CredentialsFactory(); });