Behavioural Senior Level

You need to migrate a legacy PHP application to Symfony. How do you approach this incrementally without rewriting everything at once?

Quick Tip

Lead with pragmatism: "I would not rewrite. I would set up Symfony next to the legacy app, route new features through Symfony, and migrate existing routes one at a time with tests for each. The legacy app shrinks until it disappears."

What good answers include

The Strangler Fig pattern: run Symfony alongside the legacy app and incrementally route requests to the new system. Steps: set up Symfony as a wrapper, use a catch-all controller or reverse proxy to forward unhandled routes to the legacy app, migrate one route at a time, and share the database. Strong candidates discuss: using the Symfony kernel to bootstrap alongside legacy code, sharing sessions between old and new systems, gradual extraction of services from legacy globals into injectable Symfony services, writing tests before migrating each piece, and resisting the rewrite temptation. The key insight is that migration is a series of small, shippable steps, not a big bang.

What interviewers are looking for

Senior architecture question. Candidates who propose a full rewrite are underestimating the risk and business cost. Those who describe incremental migration with the Strangler Fig pattern and test coverage demonstrate mature engineering judgement.

← All Symfony questions