Created
June 14, 2012 12:13
-
-
Save coreymcmahon/2929940 to your computer and use it in GitHub Desktop.
Using a "heavy front controller" to manage dependencies - http://www.symfonycentral.com
This file contains hidden or 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 | |
require_once __DIR__.'/../vendor/.composer/autoload.php'; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing; | |
use Symfony\Component\HttpKernel; | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
$request = Request::createFromGlobals(); | |
$routes = include __DIR__.'/../src/app.php'; | |
$context = new Routing\RequestContext(); | |
$matcher = new Routing\Matcher\UrlMatcher($routes, $context); | |
$resolver = new HttpKernel\Controller\ControllerResolver(); | |
$dispatcher = new EventDispatcher(); | |
$dispatcher->addSubscriber(new HttpKernel\EventListener\RouterListener($matcher)); | |
$framework = new Simplex\Framework($dispatcher, $resolver); | |
$response = $framework->handle($request); | |
$response->send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment