Skip to main content

Symfony

Overview

Symfony is a PHP component library and full-stack framework used by Drupal, Magento, and many enterprise apps. Its HttpKernel, DependencyInjection, and Console components are often adopted piecemeal even outside “full Symfony” projects.

Key concepts

  • Bundles — Feature packages wired into the kernel.
  • Services & DI — Autowiring, tags, compiler passes.
  • Routing & controllers — Attributes or YAML/XML/PHP config.
  • Doctrine ORM — Common pairing for persistence.
  • Messenger — Async message handling and queues.

Symfony HTTP kernel flow

Sample: attribute route (PHP 8+)

<?php

namespace App\Controller;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;

class HealthController
{
#[Route('/api/health', name: 'health', methods: ['GET'])]
public function __invoke(): JsonResponse
{
return new JsonResponse(['ok' => true]);
}
}

References