# symfony/http-kernel

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/symfony-http-kernel).**

8,121 stars · 98 forks · PHP · MIT

## Links

- GitHub: https://github.com/symfony/http-kernel
- Homepage: https://symfony.com/http-kernel
- awesome-repositories: https://awesome-repositories.com/repository/symfony-http-kernel.md

## Topics

`component` `php` `symfony` `symfony-component`

## Description

HttpKernel is the core kernel component of the Symfony framework that orchestrates the complete HTTP request-response lifecycle. It provides an event-driven pipeline that converts an incoming HTTP request into a matching response by dispatching lifecycle events for early interception, controller resolution, error handling, response modification, and deferred tasks.

The kernel automatically resolves the PHP callable that handles a request and injects its arguments using reflection and request attributes. It dispatches attribute-specific events for each PHP attribute found on a controller, enabling targeted listener responses without manual inspection. When exceptions occur during the request cycle, the kernel catches them and dispatches an event for listeners to return custom error responses. It also supports converting non-Response controller return values into proper Response objects through a view event, and allows modification of response headers, cookies, or body content just before sending.

A distinctive capability is the sub-request nesting mechanism, which allows a full request-response cycle to be executed inside another request for rendering embedded page fragments like widgets. The kernel also triggers a deferred termination event after the response has been sent to the client, enabling heavy tasks such as email delivery without blocking the request. After each request cycle, the kernel resets accumulated state in services to prevent memory leaks in long-running processes.

## Tags

### Web Development

- [Event-Driven Pipelines](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/request-and-response-transformers/event-driven-pipelines.md) — Processes HTTP requests by dispatching events through a chain of listeners that transform a request into a response.
- [Symfony Framework Integrations](https://awesome-repositories.com/f/web-development/symfony-framework-integrations.md) — Provides the core kernel component that orchestrates the complete HTTP request-response lifecycle for Symfony applications.
- [Request & Response Handling](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling.md) — Processes an HTTP request through a structured event-driven pipeline and returns a matching response. ([source](https://cdn.jsdelivr.net/gh/symfony/http-kernel@8.2/README.md))
- [Exception Response Mapping](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/error-route-handling/exception-response-mapping.md) — Catches exceptions during the request cycle and dispatches an event for listeners to return custom error responses.
- [Deferred Event Queues](https://awesome-repositories.com/f/web-development/browser-integration-utilities/dom-event-handling/event-driven-observers/deferred-event-queues.md) — Triggers a terminate event after the response is sent to the client for running heavy tasks like email delivery.
- [Exception Handling](https://awesome-repositories.com/f/web-development/exception-handling.md) — Catches exceptions thrown during the request cycle and dispatches an event so listeners can return an appropriate error Response. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [Request State Resets](https://awesome-repositories.com/f/web-development/global-state-access/request-scoped-state/request-state-resets.md) — Resets accumulated service state after each request to prevent memory leaks in long-running processes. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [HTTP Request-Response Object Layers](https://awesome-repositories.com/f/web-development/http-request-response-object-layers.md) — Converts an incoming HTTP request into a matching response through a structured, event-driven lifecycle.
- [Lifecycle Events](https://awesome-repositories.com/f/web-development/lifecycle-events.md) — Dispatches lifecycle events for early interception, error handling, response modification, and deferred tasks.
- [Pre-Send Response Modifiers](https://awesome-repositories.com/f/web-development/backend-development/request-response-handling/http-response-handling/response-metadata-accessors/response-header-modifiers/pre-send-response-modifiers.md) — Allows modification of response headers, cookies, or body content just before sending via an event. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [Sub-Request Executors](https://awesome-repositories.com/f/web-development/request-forwarding-mechanisms/sub-request-executors.md) — Allows a full request-response cycle to be executed inside another request for rendering embedded page fragments.

### Part of an Awesome List

- [Request Interception](https://awesome-repositories.com/f/awesome-lists/devtools/logging-and-diagnostics/request-interception.md) — Dispatches an early event so listeners can inspect or short-circuit the request before any controller runs. ([source](https://symfony.com/doc/current/components/http_kernel.html))

### Development Tools & Productivity

- [Controller Resolvers](https://awesome-repositories.com/f/development-tools-productivity/strict-dependency-resolvers/resolver-context-injection/controller-resolvers.md) — Resolves the PHP callable that handles a request and injects its arguments automatically.
- [Sub-Request Executors](https://awesome-repositories.com/f/development-tools-productivity/api-request-executors/sub-request-executors.md) — Executes nested sub-requests within a parent request cycle for rendering embedded page fragments.
- [Post-Response Task Execution](https://awesome-repositories.com/f/development-tools-productivity/task-execution/blocking-task-offloaders/post-response-task-execution.md) — Triggers a terminate event after the response is sent, enabling deferred work like email delivery. ([source](https://symfony.com/doc/current/components/http_kernel.html))

### Programming Languages & Runtimes

- [Controller Argument Resolvers](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/argument-mappers/controller-argument-resolvers.md) — Automatically builds controller callable arguments from request data and reflection metadata.
- [Controller Argument Injectors](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/dependency-argument-injection/controller-argument-injectors.md) — Automatically resolves controller callables and injects arguments using reflection and request attributes.
- [Reflection-Based Argument Injectors](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/dependency-argument-injection/reflection-based-argument-injectors.md) — Automatically resolves controller arguments using reflection and request attributes without manual configuration. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [Response Value Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/block-value-returns/method-return-values/response-value-mapping.md) — Dispatches a view event to convert non-Response controller return values into proper Response objects. ([source](https://symfony.com/doc/current/components/http_kernel.html))

### Software Engineering & Architecture

- [Attribute-Based](https://awesome-repositories.com/f/software-engineering-architecture/event-dispatchers/attribute-based.md) — Dispatches attribute-specific events for each PHP attribute found on a controller, enabling targeted listener responses.
- [Response Lifecycle Hooks](https://awesome-repositories.com/f/software-engineering-architecture/lifecycle-event-hooks/response-lifecycle-hooks.md) — Dispatches events at response creation and before sending to allow modification of headers, cookies, or body content.
- [Controller Resolvers](https://awesome-repositories.com/f/software-engineering-architecture/request-lifecycle-management/request-lifecycle-control/controller-resolvers.md) — Resolves the controller callable from request attributes to handle incoming HTTP requests. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [View-to-Response Converters](https://awesome-repositories.com/f/software-engineering-architecture/view-model-architectures/model-view-event-architectures/view-to-response-converters.md) — Dispatches a view event that lets listeners convert a non-Response controller return value into a proper Response object.

### Networking & Communication

- [Nested Sub-Request Executors](https://awesome-repositories.com/f/networking-communication/http-request-customization/request-execution/nested-sub-request-executors.md) — Executes nested sub-requests within a parent request cycle for rendering embedded page fragments. ([source](https://symfony.com/doc/current/components/http_kernel.html))
- [Sub-Request Executors](https://awesome-repositories.com/f/networking-communication/http-request-customization/request-execution/sub-request-executors.md) — Runs a complete request-response cycle inside another request to render embedded page fragments.
- [Pre-Send Response Modifiers](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/network-interception-tools/response-body-modifiers/response-body-setters/response-body-modifiers/pre-send-response-modifiers.md) — Alters response headers, cookies, or body content through an event just before the response is transmitted.

### User Interface & Experience

- [Controller Attribute Event Dispatchers](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/component-events/event-attribute-filtering/controller-attribute-event-dispatchers.md) — Dispatches attribute-specific events for each PHP attribute found on a controller, enabling targeted listener responses. ([source](https://symfony.com/doc/current/components/http_kernel.html))
