Skip to content

Why Symfony next ​

You've built a mini-router, talked to PDO, hashed passwords, and fought CSRF by hand. Symfony is what happens when someone productizes that checklist - with an explicit DI container and components you can use à la carte.

The honest pitch ​

Symfony is the "Angular-of-PHP" vibe more than the "Vue-of-PHP" vibe (Laravel sits closer to that second pole). Job posts in enterprise / agencies, long-lived codebases, reusable components (HttpFoundation, Console, Messenger…) - it's everywhere once you look.

I'm not saying it's "better" than Laravel. I'm saying: if you want structure you can see, Symfony is a solid next chapter after the PHP tutorial.

What you already know (mapped) ​

PHP tutorialSymfony name
Front controller public/index.phpsame file, more bootstrapping
Mini routerAttribute routes (or YAML/XML - attributes win in 2026)
Controllers as callablesController classes + invokables
$_SESSION + cookiessession + Security component
PDO prepared statementsDoctrine ORM / DBAL (PDO underneath)
CSRF token danceForm component + CSRF token manager
password_hashSecurity password hashers
Composer + PSR-4same - App\ → src/
DIY DI constructorsSymfony DependencyInjection (auto-wiring)

As you can see, the nouns change more than the physics.

What Symfony adds that you'd invent anyway ​

  • Validation constraints (instead of hand-rolled $errors arrays)
  • Migrations via Doctrine (schema in git)
  • Forms as PHP objects (fields, CSRF, validation glued together)
  • bin/console CLI - think of it as a project-local CLI router
  • Event dispatcher - "middleware" as listeners/subscribers
  • Flex recipes - Composer packages that drop config for you

Mental model in one sentence ​

A Symfony app is still request → kernel events → route → controller → response. Doctrine and Twig are helpers around that spine.

Version note ​

This tutorial targets Symfony 7-era structure (attribute routes, AssetMapper by default in new web apps, slim Flex recipes). If a path differs by one minor version, trust bin/console and the official docs - the ideas stay.

Next: get a playground app running.

Best,

-- ł.

Continues after /lab/php-tutorial-for-fe-devs/