//Register Configuration Files Service //Loads repository of configuration parameters from specified files $app->register(new \Yosymfony\Silex\ConfigServiceProvider\ConfigServiceProvider(array($app['rootFolderPath'] . "/config/"))); $app['config'] = $app->share(function () use($app) { return $app['configuration']->load('config.json'); }); // Setting application execution mode $app['debug'] = $app['config']->get('Application.Debug'); if ($app['config']->get('Application.Development')) { $applicationMode = "development"; } else { $applicationMode = "production"; } // Initializing Entity Manager Doctrine ORM $app['em'] = $app->share(function () use($app, $applicationMode) { return \Core\EntityManagerFactory::initializeEntityManager($app, $app['config']->get('Database'), $applicationMode); }); $monologConf = $app['config']->get('Log'); //Register Monolog Logging Service $app->register(new \Core\RotatingHandlerMonologServiceProvider(), array('monolog.logfile' => $app['rootFolderPath'] . '/log/' . $monologConf['filename'], 'monolog.maxfiles' => $monologConf['maxfiles'], 'monolog.level' => $monologConf['level'], 'monolog.name' => $monologConf['name'])); $app['monolog'] = $app->share($app->extend('monolog', function ($monolog, $app) { /** * @var Monolog\Logger $monolog */ $monolog->pushProcessor(new \Monolog\Processor\IntrospectionProcessor(\Monolog\Logger::ERROR)); return $monolog; })); //Register Controller Service //Dynamically loads controllers for app->match $app->register(new \Silex\Provider\ServiceControllerServiceProvider()); //Register Url Generator Service