Vortos
HTTP

HTTP

Symfony HttpKernel-based HTTP layer — attribute-driven routing, controller discovery, event subscribers, and error handling.

HTTP

vortos-http provides the HTTP layer built on Symfony's HttpKernel. Controllers are discovered via #[AsController] and #[Route] attributes at compile time. Event subscribers are wired automatically. No YAML, no XML.

Architecture

HTTP Request


public/index.php


Runner::run(Request)


Kernel ('vortos') — Symfony HttpKernel

    ├── EventDispatcher fires kernel.request
    │       ├── RouterListener (priority 8) — route matching
    │       ├── RateLimitMiddleware (priority 7)
    │       ├── AuthMiddleware (priority 6)
    │       ├── TwoFactorMiddleware (priority 5.5)
    │       ├── AuthorizationMiddleware (priority 5)
    │       ├── OwnershipMiddleware (priority 4.5)
    │       ├── FeatureAccessMiddleware (priority 4)
    │       ├── QuotaMiddleware (priority 3)
    │       └── AuditMiddleware (priority 2)

    ├── Controller resolved and called

    └── EventDispatcher fires kernel.response
            └── ResponseListener — Content-Type, charset

Installation

composer require vortos/vortos-http

Package Registration

bootstrap/app.php
use Vortos\Http\DependencyInjection\HttpPackage;

$packages = [
    new HttpPackage(),   // MUST be first
    new CachePackage(),
    new AuthPackage(),
    // ...
];

HttpPackage Must Be First

HttpPackage must be registered first. It registers the EventDispatcher and kernel that all other packages add subscribers to. Loading it after other packages causes undefined service references at compile time.

Container Parameters

HttpPackage reads these container parameters (set before build()):

ParameterRequiredDescription
kernel.project_dirYesApplication root path
kernel.envYesEnvironment name (prod, dev, test)
kernel.enable_routesYestrue to enable route discovery
kernel.debugNotrue for debug error pages (default: false)
charsetNoResponse charset (default: UTF-8)

Compiler Passes

Three compiler passes run at container build time:

PassPriorityPurpose
HttpListenerCompilerPass100Enables RouterListener when routes are on
RegisterEventSubscribersPass90Wires all kernel.event_subscriber tagged services to EventDispatcher
RouteCompilerPass80Scans #[AsController] classes for #[Route] attributes, builds RouteCollection

Module Overview

On this page