Fabien Potencier efa807aa7b [HttpKernel] fixed sub-request which should be always a GET (refs #3657) 13 tahun lalu
..
Bundle d664f5f087 Changed the wording of the exception thrown when Bundle::getAlias() returns something different to the Container::underscore version, fixes #1768 14 tahun lalu
CacheWarmer e3421a0b1d [DoctrineBridge] fixed some CS 13 tahun lalu
Config 8c0beea677 [Phpdoc] Cleaning/fixing 14 tahun lalu
Controller cd24fb86a8 change explode's limit parameter based on known variable content 13 tahun lalu
DataCollector 7720cb9be4 [HttpKernel] tagged public @api 14 tahun lalu
Debug d96c152c4c [HttpKernel] fixed error message in HttpKernel 14 tahun lalu
DependencyInjection 851eb73778 removed unused use statements 13 tahun lalu
Event 851eb73778 removed unused use statements 13 tahun lalu
EventListener efa807aa7b [HttpKernel] fixed sub-request which should be always a GET (refs #3657) 13 tahun lalu
Exception 1238bb3d53 [HttpKernel] lowered the number of level to keep in Flattened exceptions to make the tests pass when XDebug is enabled (beause of the default max nesting level of 100) 14 tahun lalu
HttpCache fbed9ff8de Update src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php 13 tahun lalu
Log e3421a0b1d [DoctrineBridge] fixed some CS 13 tahun lalu
Profiler fe62401907 optimized string starts with checks 13 tahun lalu
Util 4316595dbb fixed CS 13 tahun lalu
Client.php 5c41ec9e4f [HttpKernel][Client] Only simple (name=value without any other params) cookies can be stored in same line, so lets add every as standalone to be compliant with rfc6265 13 tahun lalu
HttpKernel.php 7720cb9be4 [HttpKernel] tagged public @api 14 tahun lalu
HttpKernelInterface.php 7720cb9be4 [HttpKernel] tagged public @api 14 tahun lalu
Kernel.php f11f7fcbe0 bumped Symfony version to 2.0.13-DEV 13 tahun lalu
KernelEvents.php 7720cb9be4 [HttpKernel] tagged public @api 14 tahun lalu
KernelInterface.php bb5fb79c3d changed the way we store the current ob level (refs #2617) 13 tahun lalu
LICENSE 89868f7901 Updated LICENSE files copyright 13 tahun lalu
README.md 997f354d53 tweaked the README files 13 tahun lalu
composer.json 208c2e468c removed the version attribute in all composer.json files 13 tahun lalu

README.md

HttpKernel Component

HttpKernel provides the building blocks to create flexible and fast HTTP-based frameworks.

HttpKernelInterface is the core interface of the Symfony2 full-stack framework:

interface HttpKernelInterface
{
    /**
     * Handles a Request to convert it to a Response.
     *
     * @param  Request $request A Request instance
     *
     * @return Response A Response instance
     */
    function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
}

It takes a Request as an input and should return a Response as an output. Using this interface makes your code compatible with all frameworks using the Symfony2 components. And this will gives you many cool features for free.

Creating a framework based on the Symfony2 components is really easy. Here is a very simple, but fully-featured framework based on the Symfony2 components:

$routes = new RouteCollection();
$routes->add('hello', new Route('/hello', array('_controller' =>
    function (Request $request) {
        return new Response(sprintf("Hello %s", $request->get('name')));
    }
)));

$request = Request::createFromGlobals();

$context = new RequestContext();
$context->fromRequest($request);

$matcher = new UrlMatcher($routes, $context);

$dispatcher = new EventDispatcher();
$dispatcher->addSubscriber(new RouterListener($matcher));

$resolver = new ControllerResolver();

$kernel = new HttpKernel($dispatcher, $resolver);

$kernel->handle($request)->send();

This is all you need to create a flexible framework with the Symfony2 components.

Want to add an HTTP reverse proxy and benefit from HTTP caching and Edge Side Includes?

$kernel = new HttpKernel($dispatcher, $resolver);

$kernel = new HttpCache($kernel, new Store(__DIR__.'/cache'));

Want to functional test this small framework?

$client = new Client($kernel);
$crawler = $client->request('GET', '/hello/Fabien');

$this->assertEquals('Fabien', $crawler->filter('p > span')->text());

Want nice error pages instead of ugly PHP exceptions?

$dispatcher->addSubscriber(new ExceptionListener(function (Request $request) {
    $msg = 'Something went wrong! ('.$request->get('exception')->getMessage().')';

    return new Response($msg, 500);
}));

And that's why the simple looking HttpKernelInterface is so powerful. It gives you access to a lot of cool features, ready to be used out of the box, with no efforts.

Resources

Unit tests:

https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/HttpKernel