Subscribe to PHP Freaks RSS

Symfony: The Fast Track, now for Symfony 8.1

syndicated from feeds.feedburner.com on June 15, 2026

In November 2019, at SymfonyCon Amsterdam, I published "Symfony 5: The Fast Track"; a book that teaches Symfony the way I like to learn: by building a real application, one Git commit at a time, from the very first composer install to production deployments, performance profiling, and a release party. Since then, the book has followed Symfony, edition after edition. The one I'm announcing today, for Symfony 8.1, is the eighth. It is also the most ambitious rewrite since the original.

The guestbook application is still the same: conferences, comments, photos, an admin backend, workflows, async processing. What changed is how we build it: Symfony UX for the frontend, Symfony AI for spam detection, the Scheduler for recurring tasks, AssetMapper for the assets, and modern Symfony idioms everywhere.

Fighting Spam with AI

The spam chapter used to call the Akismet API by hand; a fine excuse to learn the HttpClient component, but let's be honest, not how you would solve this problem in 2026. The chapter has been rewritten around Symfony AI: an agent now asks a Large Language Model whether a submitted comment is spam, with a system prompt that constrains its role and its answers.

The chapter uses OpenAI with gpt-5-mini, but the code does not care about the provider: Symfony AI abstracts OpenAI, Anthropic, Google Gemini, Mistral, and even local models via Ollama behind the same platform interface; switch providers and only the configuration changes. Nothing here requires a frontier model either: a task as narrow as spam classification would be perfectly served by a small or specialized model. The calls still happen "out of band" via Messenger, because an expensive call is an expensive call, whether it hits Akismet or a model. And the chapter teaches a design rule I care about: when the model cannot answer, fall back to human moderation. AI should help the admin, never block the guestbook.

Testing with Object Factories

Two changes in the tests chapter. Doctrine fixtures are gone, replaced by Zenstruck Foundry: each test now creates exactly the data set it needs via object factories, with realistic defaults generated by Faker. Tests become independent from each other, and reading a test tells you everything about the data it relies on.

And how do you test code that calls an LLM? You don't, at least not the model: hitting the OpenAI API in a test suite would be slow, expensive, and not even deterministic. The book replaces the platform with Symfony AI's InMemoryPlatform, wrapped in a real Agent so that the application logic is tested for real, including the "model is down" path.

No More Node.js

The styling chapter dropped Webpack Encore for AssetMapper. Importmaps, browser-native modules, no node_modules, no build step. Bootstrap is still there but Node.js disappeared from the book's requirements entirely: the first chapter no longer asks you to install it.

An SPA Feel, without the SPA

Previous editions ended with a Preact single-page application for mobile phones. This edition replaces it with a chapter on Symfony UX: Turbo makes navigation feel instant without full page reloads, Turbo Frames update just a fragment of the page, and a small Stimulus controller previews the comment photo before it is uploaded. The result feels as snappy as an SPA, written with the Twig templates we already have. The API chapter is still there, so when a real mobile application comes knocking, the backend is ready.

Scheduling without Cron

The old cron chapter became the Scheduler chapter. The comment cleanup task is now declared in PHP with the Scheduler component, which means the schedule lives in the code, ships with the application, and deploys with it. No more editing crontabs on production machines; the chapter still explains how the two approaches compare.

SymfonyCloud: From Platform.sh to Upsun

The book deploys to production from the very first chapters, and that has not changed. What changed is the platform underneath: the deployment chapters now target Upsun, the next generation of Platform.sh. If you read a previous edition, the workflow will feel familiar, on purpose: it is still SymfonyCloud from where you stand, the same symfony cloud: commands, a Git push to deploy, one environment per branch. Only the configuration file moved, from .platform.app.yaml to .upsun/config.yaml.

Modern Symfony, Everywhere

Beyond the headline chapters, the whole book has been modernized to the idioms of today's Symfony: the #[Cache] attribute on controllers instead of calls on the Response, #[AsEventListener] instead of event subscribers, #[MapQueryParameter] instead of poking at the Request, invokable console commands with services injected right in __invoke(), and typed Doctrine lifecycle events. The workflow chapter now dumps Mermaid diagrams, which GitHub and GitLab render natively. Small things, but they add up: the code you write in the book is the code you would write in a new project today.

A Book that Runs

This book is executable, and that is still my favorite thing about it. Every edition is validated by tooling that replays the whole journey exactly as a reader would: it builds the guestbook commit by commit, runs the test suite at every step, deploys each of the 27 deployable steps to Upsun and asserts the live pages, and takes the 40 screenshots you see in the book from the running application. If a chapter breaks, the build breaks.

Fun fact: this edition's validation run found a real bug: a twelve-year-old limitation in Symfony's HttpCache that serves file responses with an empty body. The bug itself is next on my list.

Read It Now

The English edition is available online, for free, at symfony.com/book. The code lives on GitHub, with one Git tag per step; check out any tag to compare your code with mine at that exact point of the journey. And if you would rather explore the finished application first, the Symfony CLI sets everything up for you, web server and containers included:



$ symfony new --version=8.1-1 --book guestbook

The book is also available in five languages, fully translated for this edition: French, German, Italian, Japanese, and Russian.

Six years and eight editions later, I still believe the fastest way to learn Symfony is to build something real. Build the guestbook.


Sponsor the Symfony project.