Symfony Code Review: What an External Reviewer Checks in a Symfony Project

#symfony code review

Founder & Lead Developer

Expert in software development and legacy code optimization

LinkedIn

When a tech lead asks us for a Symfony code review, the first question is usually about scope. What exactly will an outside reviewer look at, and how is that different from the general audit they read about somewhere else? This post answers that for Symfony projects specifically. It walks through the checklist we use, area by area, and then explains how the findings get rated and what ends up in the report.

If you want the general process (discovery interview, automated analysis, manual review, walkthrough), we described it in the methodology behind a PHP application audit. The list below sits inside that process. It is the part that only makes sense when the framework is Symfony.

Why a Symfony code review needs its own checklist

A lot of Symfony risk hides in configuration rather than in PHP classes. A firewall that matches the wrong path pattern, a service that is public for no reason, a Messenger transport with no failure queue: none of these show up as ugly code. Static analysis tools read the PHP and mostly ignore the YAML, the attributes and the container that ties them together. So a reviewer who knows the framework spends a good share of the time reading config/, running bin/console debug:* commands and comparing what the container actually builds with what the team thinks it builds.

Symfony and PHP versions, and the deprecation backlog

We start with the boring facts, because they shape everything else. Which Symfony version is installed, and is it still receiving security fixes? Which PHP version runs in production, and does it match the one in CI and on developer machines? We check composer.lock rather than composer.json, since the lock file is what actually ships.

Then we look at deprecations. Running the test suite with the deprecation helper enabled, or simply reading the deprecation log from the profiler, shows how much work the next major upgrade will cost. A project with a few dozen deprecation notices is in decent shape. A project with thousands, many coming from abandoned bundles, has an upgrade problem that the team should know about before it plans the next year. Our guide on Symfony LTS versions and support windows covers the timelines in more detail.

Service configuration smells

Autowiring made Symfony configuration much shorter, and it also made some mistakes easier to miss. Things we look for:

  • Services marked public that are fetched from the container at runtime, which usually means a service locator pattern grew where dependency injection should have been used.
  • Classes with ten or more constructor arguments. That is rarely a container problem. It is a design problem that the container makes painless to ignore.
  • Parameters read with getenv() or $_ENV deep inside services instead of being injected through configuration.
  • Large services.yaml files where half the definitions duplicate what autowiring would do anyway, which makes the meaningful overrides hard to spot.
  • Compiler passes or event subscribers that nobody on the current team can explain.

None of these break production on their own. Together they tell us how hard it is for a new developer to change something without side effects.

Security: firewalls, voters, CSRF and secrets

This is where we spend the most time, because the consequences are the largest. We read security.yaml line by line and check the firewall order, since the first matching firewall wins and a broad pattern near the top can quietly cover routes meant for a stricter one. We check access_control rules against the actual route list from debug:router, looking for admin or API paths that no rule covers.

Authorization logic gets its own pass. Voters are the right place for "can this user edit this invoice" decisions. When we find if ($user->getRole() === 'ADMIN') scattered across controllers, we note every place, because each one is a spot where a future change can open a hole. Our article on the Symfony Security component in 2026 shows the patterns we recommend instead.

We also check that forms keep CSRF protection on, that stateless API endpoints authenticate in some other way, and that login throttling is configured. For secrets, we look at whether credentials live in the Symfony secrets vault or in environment variables managed by the deployment platform, and whether any .env.local, dumped config or private key ever landed in Git history. That last check takes a few minutes with the right tool and finds something more often than teams expect.

Doctrine: N+1 queries, migration state and raw SQL

Doctrine problems are mostly performance problems that turn into availability problems under load. We open the profiler on the heaviest pages and count queries. A list view that runs one query per row is the classic N+1 pattern, and the fix (a join with an explicit select, or a dedicated read query) is usually small once someone has found it.

We compare the mapping with the real database by running doctrine:schema:validate and checking whether doctrine:migrations:diff produces an empty migration. If it does not, the schema in production has drifted from the code, and every future migration carries some risk. We also read the existing migrations for destructive changes without a rollback plan.

Raw SQL is fine when it is parameterized and when there is a reason for it. We search for string concatenation inside executeQuery, createNativeQuery and DQL built from request data, because that is where injection still shows up in otherwise modern codebases.

Messenger and background work

If the project uses Symfony Messenger, we check which transports are configured and whether a failure transport exists. Without one, a message that throws too often simply disappears. We look at retry strategies, at whether handlers are idempotent (can the same message run twice without double-charging a customer?), and at how workers are supervised in production. Workers that never restart slowly leak memory, so we check for --memory-limit or --time-limit settings and a process manager that brings them back.

Tests and CI

A coverage number says little on its own, so we look at what the tests protect. Are the money paths covered, meaning checkout, invoicing, permissions and imports? Do functional tests hit the real security configuration, or do they log in a user in a way that skips the firewall? Does the suite run in CI on every pull request, and does a failing test actually block the merge?

We also look at what else CI runs. PHPStan or Psalm at a meaningful level, a coding standard check and composer audit for known vulnerable packages are cheap and catch a surprising amount. A pipeline that only runs phpunit leaves those findings for the reviewer to make by hand.

Logging, monitoring and deployment

Monolog configuration tells us how the team will learn about problems. We check that production logs go somewhere searchable, that log levels are sensible, and that personal data such as email addresses, tokens or full request bodies is not written to logs in plain text. Error tracking (Sentry or a similar tool) and basic health checks should be in place.

For deployment we look at how the application gets to production. Is the build reproducible? Does it run composer install --no-dev with an optimized autoloader and warm the cache before the switch? Are migrations run as a controlled step? Is APP_ENV=prod with debug off, and is the profiler unreachable from the internet? We still find exposed profilers more often than we would like.

How findings are rated

Every finding gets a severity and an effort estimate. We use four severity levels. Critical means exploitable now or likely to cause data loss, and should be fixed this week. High means a real risk that should be planned into the next sprint or two. Medium covers maintainability and performance issues that will cost money over time. Low collects style and hygiene items that are worth fixing when someone touches the code anyway.

The effort estimate matters as much as the severity. A critical finding that takes an hour to fix and a medium one that takes three weeks need very different conversations with the product owner. Putting both numbers next to each other lets the team sort the list into "do now", "plan" and "accept for now" without another meeting.

What the report looks like

The report starts with a short summary written for someone who will not read the rest: overall state, the handful of findings that matter most and a rough estimate of the work involved. After that comes the full list, grouped by the areas above, with the file and line, a description of the problem, why it matters and a concrete suggestion for the fix. Where it helps, we include a code snippet showing the corrected version.

We finish with a walkthrough call where the team can push back on findings. Sometimes there is context we did not have, and a finding gets downgraded. We plan time for that conversation from the start. If you are wondering about budget, our post on what a PHP code audit costs in Germany gives realistic ranges by project size.

Getting a Symfony code review from Wolf-Tech

We review Symfony projects for teams that want an outside view before an upgrade, an investment round, a handover between agencies or simply because the codebase has grown faster than anyone's understanding of it. The review is part of our code quality consulting, and when the findings point to deeper structural work, we can help with that through legacy code optimization.

If you would like us to look at your project, write to hello@wolf-tech.io or have a look at wolf-tech.io. A short description of your Symfony version, team size and the reason you are asking is enough to get started.