Symfony interview questions and answers for PHP developers

Symfony interview questions test whether you understand how the framework is put together, not only how to make a controller. Expect questions on the request lifecycle and kernel events, the service container with autowiring and tags, Doctrine entities and the unit of work, forms and validation, security firewalls and voters, and async work with Messenger. Senior rounds add performance, caching, upgrades between major versions and design choices in large codebases.

By Published 6 min read

How Symfony interviews are structured

Symfony roles are usually backend PHP jobs at agencies, e-commerce companies, SaaS products and public-sector projects, often with long-lived codebases. Interviews tend to have a PHP language round, a framework round, a code review or take-home task, and a discussion of architecture. Because Symfony components also sit inside other PHP projects, framework knowledge sometimes overlaps with Laravel or Drupal roles. Core language topics such as types, references and Composer are covered in PHP interview questions.

  1. PHP screenTypes, interfaces, traits, exceptions, Composer autoloading and recent language features.
  2. Framework conceptsRequest lifecycle, routing, controllers, services, configuration and environments.
  3. Code taskA small API endpoint or a pull request to review, judged on structure, validation, security and tests.
  4. ArchitectureHow you would organize a growing application, handle background work, and keep upgrades routine.

Fundamentals questions

Symfony basics
QuestionWhat it testsWhat a strong answer shows
Components versus the framework?Big pictureComponents such as HttpFoundation, Routing, Console and EventDispatcher are standalone libraries. The full-stack framework wires them together with a kernel, configuration and bundles.
What happens during a request?LifecycleThe front controller boots the kernel, a Request object is created, the router matches a route, the controller runs and returns a Response, and the kernel sends it. Events fire around each step.
Name the main kernel events.Extension pointskernel.request, kernel.controller, kernel.view, kernel.response, kernel.exception and kernel.terminate. Listeners on them handle locale, auth checks, formatting and cleanup.
What is a bundle?PackagingA package of code and configuration that plugs into the framework. Application code no longer needs to be a bundle; third-party features usually are.
What does Flex do?ToolingA Composer plugin that applies recipes when packages are installed, adding configuration files and environment variables so a package works with little manual setup.
How are routes defined?RoutingMost often with PHP attributes on controller methods in recent versions, or in YAML or PHP files. Requirements, defaults and methods control matching.
How do environments work?Configurationdev, prod and test load different config, set by APP_ENV. Environment variables come from the real environment or .env files, and sensitive values can go in the secrets vault.
What does AbstractController give you?ControllersShortcuts such as render, json, redirectToRoute, createForm and denyAccessUnlessGranted. Controllers can also be plain services.
What is Twig and why does it auto-escape?TemplatingThe default template engine. Auto-escaping output by context protects against cross-site scripting unless a developer deliberately marks content as safe.
What is the profiler for?DebuggingIn dev, it records each request's timing, queries, events, logs and container data, shown in the web debug toolbar.
Symfony basics. Scroll sideways on a small screen.

Intermediate: services, Doctrine and forms

  • What does autowiring do? The container reads constructor type hints and passes the matching services, so most classes need no manual definitions. When two services implement one interface, you bind or alias the one to use.
  • What is autoconfigure? It adds tags automatically based on the interfaces a class implements, so event subscribers, console commands and voters register themselves.
  • Why are services private by default? It keeps code from pulling services out of the container at run time, which hides dependencies. Inject what you need instead, and the compiled container can remove unused services.
  • How do you replace or wrap a service? Decoration: register a new service that decorates the original, receives it as an inner service, and adds behavior such as caching or logging.
  • What is the unit of work in Doctrine? The EntityManager tracks loaded and persisted entities and writes all changes in one transaction on flush(). persist() marks new entities; flush() sends the SQL.
  • How do you spot and fix N+1 queries? The profiler shows the query count. Fetch related data with a join in a query builder or DQL, or adjust fetch modes for the specific use, rather than looping over lazy relations.
  • How are schema changes handled? Doctrine Migrations generates versioned migration classes from entity changes, which are reviewed, committed and run during deployment.
  • How do forms and validation fit together? A form type maps fields to an object, handles the request and runs validation constraints declared on the object, often as attributes, before you save anything.
<?php

namespace App\Controller;

use App\Entity\Invoice;
use App\Service\InvoicePdf;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

final class InvoiceController extends AbstractController
{
    public function __construct(private InvoicePdf $pdf) {}

    #[Route('/invoices/{id}/pdf', name: 'invoice_pdf', methods: ['GET'])]
    public function pdf(Invoice $invoice): Response
    {
        $this->denyAccessUnlessGranted('VIEW', $invoice);

        return new Response($this->pdf->render($invoice), 200, [
            'Content-Type' => 'application/pdf',
        ]);
    }
}
A controller with an attribute route, an autowired service and a security check. PHP; not executed here.

Interviewers use a snippet like this to ask follow-ups: how the Invoice argument is loaded from the id (entity value resolution), where the VIEW decision lives (a voter), and why the PDF service is injected instead of fetched. The namespace of the Route attribute has moved between versions, so say you would check it against the version in use.

Senior and scenario questions

Security, async work, performance and upgrades
ScenarioWhat it testsWhat a strong answer shows
How does authentication work?SecurityFirewalls match parts of the app, authenticators turn a request into a passport and a token, user providers load users, and password hashers verify credentials. Access control and voters decide authorization afterwards.
When do you write a voter instead of checking roles?AuthorizationWhen the decision depends on the object, such as only the owner or their manager may edit an invoice. A voter keeps that rule in one tested class instead of scattered if statements.
How do you move slow work out of the request?MessengerDispatch a message, route it to an async transport such as a database, Redis or AMQP queue, and run workers. Configure retries with backoff and a failure transport for messages that keep failing.
A Messenger worker slowly uses more memory. What do you do?WorkersRun workers with limits on messages, time or memory so a supervisor restarts them, clear the EntityManager between messages, and look for services that keep state.
How would you speed up a page that does heavy work for every visitor?CachingHTTP caching headers with a reverse proxy where pages are shareable, the Cache component with tags for computed data, Doctrine query and result caching where safe, and OPcache with preloading in production.
How do you upgrade to a new major version?UpgradesFix deprecation notices on the latest minor release first, since the next major removes what was deprecated, update recipes, run the test suite, and upgrade bundles in step. Long-term support releases help plan the timing.
How would you keep a large Symfony app maintainable?ArchitectureOrganize by domain rather than only by technical layer, keep controllers thin, put business rules in services or domain objects, use events for side effects, and enforce boundaries with tests and static analysis.
Doctrine or a different approach to persistence, and how does it compare with Eloquent?Trade-offsDoctrine is a data mapper: entities are plain objects and the EntityManager persists them. Laravel's Eloquent is active record: models save themselves. Data mapper suits complex domains; active record is quicker for simple CRUD.
Security, async work, performance and upgrades. Scroll sideways on a small screen.
  • Event listener or event subscriber? A subscriber declares its own events and priorities in code, which keeps the wiring next to the logic. A listener is configured from outside, which helps when the same class is reused with different events.
  • How do you write a console command? Extend the Command class or use the command attribute, define arguments and options, and keep the real work in a service so it can be tested and reused from a controller or a message handler.
  • What are tagged iterators for? Injecting every service with a given tag, such as all payment providers, as one iterable, so adding a provider means adding a class and no change to the consumer.
  • WebTestCase versus KernelTestCase? KernelTestCase boots the kernel to test services from the container. WebTestCase adds a client that makes requests through the whole stack, for functional tests of routes, forms and security.
  • How do you keep secrets out of the repository? Environment variables set on the server, or the encrypted secrets vault with the decryption key kept only in the deployment environment, never real credentials in committed .env files.

Fictional example

Answering "Tell me about a performance problem you fixed in Symfony"
Our order history page for business customers got slow as accounts grew. The profiler showed hundreds of queries on a large account: we loaded orders, then each order's lines and products lazily in Twig. I wrote a repository method that joined lines and products in one query with pagination, and changed the template to use it. The query count dropped to a handful. Then I noticed the totals block recalculated tax rules on every request, so I cached that result with a tag per account and cleared it when an order changed. I added a functional test asserting the query count stays under a limit, so the problem would show up in CI if someone reintroduced lazy loading in the template.

One-week practice plan

  1. Day 1Draw the request lifecycle with every kernel event, and write one listener and one subscriber.
  2. Day 2Build a small service graph with an interface, two implementations, a binding and a decorator, then dump the container to check it.
  3. Day 3Create two related Doctrine entities, trigger an N+1 problem on purpose, and fix it with a join.
  4. Day 4Add a form with validation and a voter for ownership, with functional tests for allowed and denied users.
  5. Day 5Move an email or PDF job to Messenger with retries and a failure transport.
  6. Days 6 and 7Rehearse architecture answers and the Doctrine versus Eloquent comparison; see Laravel interview questions if the team uses both. If you are coming from Java, compare the MVC flow with Struts.

Framework rounds ask you to explain invisible machinery such as compiled containers and kernel events, and it is hard to judge your own clarity in the moment. Natively, an AI interview assistant for Mac and Windows, can transcribe a mock Symfony interview on your computer and keep the notes and transcript to review later. In practice it can read a screenshot of a controller, service definition or error page and suggest how to explain it, and with Pro or the free trial it can use the résumé and job description you add.

Questions people ask

What Symfony questions are asked in interviews?

Components versus the framework, the request lifecycle and kernel events, routing, the service container with autowiring and tags, Doctrine and the unit of work, forms and validation, security and voters, Messenger and upgrades.

What is autowiring in Symfony?

The service container reads constructor type hints and injects matching services automatically. When several services fit one interface, you bind or alias the one to use.

What is a voter in Symfony?

A class that decides whether the current user may perform an action on a specific object, such as editing their own invoice. It keeps object-level permission rules in one testable place.

How is Symfony different from Laravel?

Both are full-stack PHP frameworks. Symfony leans on explicit dependency injection and Doctrine, a data mapper ORM, while Laravel favors conventions, facades and Eloquent, an active record ORM.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP