Skip to content

Instantly share code, notes, and snippets.

@SpartakusMd SpartakusMd/app.php
Created May 26, 2016

Embed
What would you like to do?
Replacement for default Symfony2 app.php
<?php
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = require __DIR__ . '/../app/autoload.php';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$loader = new Symfony\Component\ClassLoader\ApcClassLoader('sf2', $loader);
$loader->register(true);
*/
$environment = 'prod';
$debug = false;
if(getenv('APP_ENV') == 'dev') {
Debug::enable();
$environment = 'dev';
$debug = true;
} else {
include_once __DIR__ . '/../app/bootstrap.php.cache';
}
require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel($environment, $debug);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.