Example #1
0
<?php

$app = new Silex\Application();
$app['debug'] = DEBUG;
Symfony\Component\Debug\ErrorHandler::register();
if ('cli' !== php_sapi_name()) {
    Symfony\Component\Debug\ExceptionHandler::register();
}
$app->register(new Silex\Provider\MonologServiceProvider(), array('monolog.logfile' => APP_DIR . '/../logs/app.error.log', 'monolog.level' => Monolog\Logger::ERROR));
$templateDir = APP_DIR . VIEWS_LOCATION;
$templatePaths = array($templateDir, $templateDir . '/templates', $templateDir . '/pages', $templateDir . '/error-pages');
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => $templatePaths, 'twig.options' => array('cache' => APP_DIR . 'cache')));
$app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider(), array('locale_fallbacks' => array('en')));
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Aws\Silex\AwsServiceProvider(), array('aws.config' => array('key' => AWS_USER_ACCESS_KEY, 'secret' => AWS_USER_SECRET_KEY, 'region' => 'eu-west-1')));
$app['twig']->addGlobal('publicAssetsLocation', PUBLIC_ASSETS_LOCATION);
Example #2
0
 /**
  * Symfony Debug Fatal Checker Emulator
  *
  * da von Symfony eine "register_shutdown_function" mit exit ausführt
  * muss diese umgangen werden
  */
 protected function recoverSymfonyDebugger()
 {
     if (is_callable($this->previousErrorHandler) && $this->previousErrorHandler[0] instanceof Symfony\Component\Debug\ErrorHandler) {
         Symfony\Component\Debug\ErrorHandler::register(new Symfony\Component\Debug\ErrorHandler(new Symfony\Component\Debug\BufferingLogger()));
     }
 }