Last active
June 2, 2019 03:38
-
-
Save chrisguitarguy/07d6b9df23c6984fa5424c5a18b81f7e to your computer and use it in GitHub Desktop.
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 | |
use Symfony\Component\HttpKernel\Kernel; | |
class AppKernel extends Kernel | |
{ | |
public static function fromEnvironment() | |
{ | |
$env = getenv('APP_ENVIRONMENT') ?: 'prod'; | |
$debug = filter_var(getenv('APP_DEBUG'), FILTER_VALIDATE_BOOLEAN); | |
return new self($env, $debug); | |
} | |
// ... | |
} |
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 | |
use Symfony\Component\HttpFoundation\Request; | |
// require autoloader or bootstrap | |
require __DIR__ . '/../app/autoload.php'; | |
// from the environment! | |
$app = AppKernel::fromEnvironment(); | |
// just like normal | |
$request = Request::createFromGlobals(); | |
$response = $app->handle($request); | |
$response->send(); | |
$app->terminate($request, $response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment