Glossary · Software Architecture

What is the strangler fig pattern?

Short answer

The strangler fig pattern is a way to replace a legacy system gradually: you put a routing layer in front of it, build new functionality piece by piece in a modern system, and redirect traffic for each piece as it is ready, until the old system can be switched off. It avoids the risk of a single big-bang rewrite.

Where the name comes from

A strangler fig grows around a host tree until it stands on its own and the host is gone. Martin Fowler used the image in 2004 for replacing software the same way.

How to apply it

  1. Intercept: route all requests through a proxy, API gateway or the web server, so you can decide per URL or feature where traffic goes.
  2. Pick a slice: start with a valuable, well-bounded feature, such as the product catalogue or invoicing.
  3. Rebuild and redirect: implement it in the new system, sync or migrate its data, and switch its routes over, ideally behind a feature flag so you can roll back.
  4. Repeat until little remains, then retire the old system.

Tips

  • Agree on how data stays consistent while both systems run: one owner per entity, plus sync jobs or events.
  • Measure parity: compare outputs of old and new for the same inputs before switching.
  • Delete migrated code from the legacy side so the two don’t drift.

For PHP estates this often means moving from an old custom framework or PHP 5/7 codebase to Laravel or Symfony on a current PHP version, one module at a time.

Published · Updated · By · All terms

Go deeper