Created
March 25, 2011 03:49
-
-
Save ericclemmons/886334 to your computer and use it in GitHub Desktop.
Zend-friendly app.php using APPLICATION_ENV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is the revised `web/app.php` (click the previous edit of this gist to see the original) | |
// | |
// For those of us that deploy along-side Zend Framework apps, whose convention has been to pivot configuration | |
// around APPLICATION_ENV, `web/app.php` and `web/app_dev.php` is redundant. | |
require_once __DIR__.'/../app/bootstrap.php.cache'; | |
require_once __DIR__.'/../app/AppKernel.php'; | |
//require_once __DIR__.'/../app/bootstrap_cache.php.cache'; | |
//require_once __DIR__.'/../app/AppCache.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
// Define application environment, per Zend's suggestion | |
defined('APPLICATION_ENV') | |
|| define('APPLICATION_ENV', getenv('APPLICATION_ENV') ?: 'production'); | |
// Map Zend APPLICATION_ENV to Symfony Kernel Environment | |
$env = (APPLICATION_ENV === 'staging') ? 'stage' | |
: (APPLICATION_ENV === 'testing') ? 'test' | |
: (APPLICATION_ENV === 'development') ? 'dev' | |
: 'prod'; | |
//$kernel = new AppCache(new AppKernel('prod', false)); | |
$kernel = new AppKernel($env, $env !== 'prod') // Debug when not in production | |
$kernel->handle(Request::createFromGlobals())->send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment