Behavioural Mid Level

When would you create a custom Symfony bundle versus keeping code as services within the application? What has changed in modern Symfony regarding bundle usage?

Quick Tip

Show the modern approach: "Application code goes in src/ with autowiring and attributes. I only create a bundle when the code needs to be distributed as a Composer package across multiple projects."

What good answers include

Modern Symfony (4+) moved away from bundles for application code. Application logic lives in src/ with autowiring — no bundle needed. Bundles are for reusable, distributable packages shared across projects (like a payment SDK or an admin panel). The shift happened because application bundles added boilerplate (Extension class, Configuration class, bundle registration) with no benefit for code that only runs in one project. Strong candidates explain: when to extract a bundle (shared across multiple projects), Flex recipes for third-party bundles, and the role of compiler passes in bundles versus service configuration in applications.

What interviewers are looking for

Tests whether candidates understand modern Symfony conventions versus legacy patterns. Those who create application bundles for every feature are following outdated practices. Look for understanding of when the bundle abstraction adds genuine value.

← All Symfony questions