This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/HttpKernel
Fabien Potencier abf2edf81a minor #11483 fix some docblocks (xabbuh)
This PR was merged into the 2.3 branch.

Discussion
----------

fix some docblocks

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

1775da5 fix some docblocks
2014-08-02 09:53:48 +02:00
..
Bundle unified return null usages 2014-04-16 09:43:51 +02:00
CacheClearer made {@inheritdoc} annotations consistent across the board 2014-04-16 09:04:20 +02:00
CacheWarmer fixed typo 2014-07-11 11:32:34 +02:00
Config [HttpKernel] tweaked previous merge 2013-04-07 17:51:54 +02:00
Controller fixed types in phpdocs 2014-04-16 12:30:19 +02:00
DataCollector fixed types in phpdocs 2014-04-16 12:30:19 +02:00
Debug fix some docblocks 2014-08-02 08:27:27 +02:00
DependencyInjection made {@inheritdoc} annotations consistent across the board 2014-04-16 09:04:20 +02:00
Event fixed types in phpdocs 2014-04-16 12:30:19 +02:00
EventListener made phpdoc types consistent with those defined in Hack 2014-04-15 07:41:45 +02:00
Exception fixed types in phpdocs 2014-04-16 12:30:19 +02:00
Fragment fix some docblocks 2014-08-02 08:27:27 +02:00
HttpCache [HttpKernel] fixed default TTL not applied under certain conditions 2014-05-12 17:25:47 +02:00
Log fixed types in phpdocs 2014-04-16 12:30:19 +02:00
Profiler minor #10717 unified return null usages (fabpot) 2014-04-18 22:35:25 +02:00
Tests fixed CS 2014-07-29 20:09:11 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md Pass exceptions from the ExceptionListener to Monolog 2013-05-10 11:42:12 +02:00
Client.php [HttpKernel] fixed file uploads in functional tests when no file was selected 2014-05-21 14:41:36 +02:00
composer.json Revert "bug #10894 [HttpKernel] removed absolute paths from the generated container (fabpot)" 2014-05-26 18:42:04 +02:00
HttpKernel.php made phpdoc types consistent with those defined in Hack 2014-04-15 07:41:45 +02:00
HttpKernelInterface.php made phpdoc types consistent with those defined in Hack 2014-04-15 07:41:45 +02:00
Kernel.php bumped Symfony version to 2.3.19 2014-07-15 21:58:41 +02:00
KernelEvents.php Fixed typos 2012-07-28 22:02:29 +00:00
KernelInterface.php fixed types in phpdocs 2014-04-16 12:30:19 +02:00
LICENSE update year on licenses 2014-01-07 08:19:25 -05:00
phpunit.xml.dist removed defaults from PHPUnit configuration 2014-07-07 12:13:42 +02:00
README.md updated the composer install command to reflect changes in Composer 2013-09-18 09:27:26 +02:00
TerminableInterface.php fixed CS 2012-07-09 14:54:20 +02:00
UriSigner.php fixed types in phpdocs 2014-04-16 12:30:19 +02:00

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 give 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

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/HttpKernel/
$ composer.phar install
$ phpunit