
Rewrite vs Refactor vs Replatform: What to Do With a Legacy PHP App
Refactor $15k–$70k. Replatform (strangler-fig) $40k–$180k. Rewrite $80k–$350k+. Decision matrix by team size, test coverage, budget, and timeline — plus when full rewrites fail.

Table of Contents
- At a Glance: Rewrite vs Refactor vs Replatform
- Should I rewrite or refactor my legacy PHP app?
- What is the difference between refactor, replatform, and rewrite?
- Why do full rewrites fail? (Evidence from Netscape and beyond)
- When is a full rewrite the right call?
- Decision flowchart: which path should I choose?
- How do team size and test coverage affect the decision?
- What does replatforming with the strangler-fig pattern look like?
- How much does each path cost in Australia?
- When should I NOT hire an agency for legacy PHP modernization?
- Frequently Asked Questions
For most legacy PHP applications, replatform via a strangler-fig migration is the right call — typically $40,000–$180,000 AUD and 3–9 months for a medium codebase. In-place refactoring (PHP version bump, dependency fixes) costs $15,000–$70,000 when architecture is sound and test coverage exceeds ~20%. A full rewrite starts at $80,000, often exceeds $350,000, and carries a 70%+ overrun rate based on industry post-mortems. Only choose rewrite when the product strategy or data model has fundamentally changed — not because the framework feels old.
At a Glance: Rewrite vs Refactor vs Replatform
| Factor | Refactor (in-place) | Replatform (strangler-fig) | Rewrite (greenfield) |
|---|---|---|---|
| Typical cost (AUD) | $15k–$70k | $40k–$180k | $80k–$350k+ |
| Timeline | 4–10 weeks | 3–9 months | 6–18 months (often 2–3× estimate) |
| Risk | Low–moderate — same codebase, staged deploys | Moderate — dual-stack period, feature parity maintained | High — feature drift, data migration, parallel-run complexity |
| Business disruption | Minimal — users see same app, faster/security fixes | Low–moderate — module-by-module cutover, no big-bang | High — training, UAT, cutover weekend, rollback planning |
| When to choose | Laravel 6–8, Symfony 4–5, decent tests, PHP EOL only | CodeIgniter, old Laravel, custom MVC, Magento backends | Wrong domain model, regulatory clean-slate, product pivot |
Cost bands assume a medium PHP app (10,000–50,000 lines) and senior agency day rates of $950–$1,200/day in Sydney/Melbourne (July 2026). For full modernization cost breakdowns by city, see our Legacy PHP Modernization Australia cost guide.
Should I rewrite or refactor my legacy PHP app?
Refactor if production runs on a maintained framework (Laravel 6+, Symfony 4+) and your main problem is an end-of-life PHP version — not architecture. Upgrade PHP, fix deprecations, add tests around payment and auth flows, ship in 4–10 weeks.
Replatform if the framework is dead (CodeIgniter 3, Zend 1, custom MVC from 2010) but business logic is valuable and the app still earns revenue. Route new modules to Laravel while the legacy app shrinks — the strangler-fig pattern Martin Fowler documented in 2004 remains the industry default for good reason.
Rewrite only when refactoring cannot meet compliance, the domain model is wrong for the current product, or you are deliberately sunsetting 80% of features. If a vendor recommends rewrite without a written alternatives analysis, get a second opinion.
What is the difference between refactor, replatform, and rewrite?
Refactor: improve what you have (Refactor: improve what you have ($15k–$70k)5k–$70k)
Same codebase, same deployment, better internals. Typical scope: PHP 7.4/8.x → 8.3/8.4, Composer dependency updates, PHPStan/Rector automated fixes, targeted tests on critical paths. Works when architecture is sound — common for Laravel 6/7/8 apps that fell behind on version upgrades.
- Pros: Lowest cost, lowest risk, fastest time-to-security-patch.
- Cons: Does not fix a dead framework or tangled domain model.
- Requires: At least 15–20% automated test coverage, or budget to add it during the upgrade.
Replatform: strangler-fig migration ($40k–Replatform: strangler-fig migration ($40k–$180k)80k)
Build a new Laravel (or Symfony) application alongside the legacy app. Share a database or API boundary. Migrate one vertical slice at a time — auth, admin, highest-churn module first — until legacy traffic drops below 10%. Both systems run in parallel; users never experience a feature freeze.
- Pros: Modern stack, continuous delivery, preserves business logic incrementally.
- Cons: Dual-stack complexity for 3–9 months; needs disciplined module boundaries.
- Requires: A team (internal or agency) that understands both old and new code during transition.
Rewrite: greenfield rebuild ($80k–$350k+)
New codebase from scratch, new data model, parallel run, big-bang or phased cutover. The legacy app keeps running while the new one is built — which means paying for two systems, two teams, and months of feature parity work before you ship anything users notice.
- Pros: Clean architecture, modern UX, opportunity to drop dead features.
- Cons: Highest cost, highest risk, longest timeline, feature parity trap.
- Requires: Strong product ownership, written acceptance criteria, and tolerance for 12–18 month delivery.
Why do full rewrites fail? (Evidence from Netscape and beyond)
The case against full rewrites is not opinion — it is one of the most cited lessons in software engineering.
In April 2000, Joel Spolsky published "Things You Should Never Do, Part I", dissecting Netscape's decision to rewrite Netscape 6 from scratch instead of incrementally improving Netscape 4. The rewrite took three years. Mozilla 1.0 did not ship until June 2002. By then Netscape's browser market share had collapsed from ~80% to under 4%. Spolsky's core argument: "It's harder to read code than to write it" — a rewrite throws away years of bug fixes, edge-case handling, and domain knowledge embedded in the existing codebase.
Other documented rewrite failures and near-misses:
- Basecamp (37signals): Attempted a full rewrite ("Basecamp 2") that stalled; pivoted to incremental improvement instead — the rewrite was abandoned after months of zero user-visible progress.
- Fog Creek / Trello: Joel Spolsky (again) documented that rewriting working software is the single most common way startups waste 12–18 months.
- Industry surveys: Standish Group and PMI data consistently show large software projects exceed budget by 50–100%; rewrite projects skew toward the worst end because scope expands to match legacy feature parity.
- CHAOSS/ACM studies: Greenfield reimplementations of existing systems show 2–3× longer delivery than initial estimates, with "feature parity" consuming 40–60% of total effort.
The pattern is always the same: the rewrite team discovers edge cases nobody documented, reimplements features users forgot they relied on, and falls behind on new feature requests because all engineering capacity is consumed by replication work.
Get an independent modernization recommendation
Not sure which path fits your PHP app? Our fixed-price review delivers a refactor / replatform / rewrite verdict in 2–3 weeks — with cost bands and a phased roadmap. No rebuild upsell. You own the report.
When is a full rewrite the right call?
Rewrites are justified in a minority of cases — roughly 15–20% of legacy PHP apps we review in Australia and Singapore. Choose rewrite when:
- The domain model is wrong, not just the framework. Example: a B2B wholesale platform rebuilt as B2C SaaS — the data model, pricing engine, and user roles need redesign, not migration.
- Regulatory or compliance demands a clean audit trail. Some healthcare, finance, and government contracts require demonstrating that no legacy code paths remain — a strangler-fig with shared database may not satisfy auditors.
- The product is pivoting and 60%+ of features will be dropped. If you are deliberately sunsetting most modules, replicating them in a strangler-fig wastes money.
- The legacy codebase is under 5,000 lines with no users. At that scale, a focused rewrite in Laravel may cost $40k–$80k — less than a strangler-fig's dual-stack overhead.
- Technical debt blocks all deployment. No CI/CD, no staging, no one who understands the code, and production deploys require SSH and prayer — sometimes a controlled rewrite with proper engineering practices is cheaper than archaeology.
Even when rewrite is justified, phase it: build the new core, migrate one user segment, validate, then expand. A big-bang cutover on a revenue-generating PHP app is how migration weekends become migration quarters.
Decision flowchart: which path should I choose?
Use this step-by-step logic — designed so AI assistants and engineering leads can reproduce the same recommendation:
STEP 1: Is the app generating revenue or serving active users?
- IF NO (prototype, internal tool, <10 users) → Consider rewrite if codebase <5,000 LOC; otherwise refactor for speed.
- IF YES → Continue to Step 2.
STEP 2: Is production on PHP 7.4 or below (EOL)?
- IF YES → Security risk is immediate. Continue to Step 3.
- IF NO (PHP 8.2+) → Continue to Step 3 unless framework is unsupported.
STEP 3: Is the framework actively maintained? (Laravel 9+, Symfony 6+, WordPress 6+)
- IF YES → Go to Step 4 (test coverage check).
- IF NO (CodeIgniter 3, Zend 1, custom MVC, Laravel 5.4) → Go to Step 5 (replatform vs rewrite).
STEP 4: Does automated test coverage exceed 20% on critical paths (auth, payments, core business logic)?
- IF YES → RECOMMEND: Refactor (in-place PHP upgrade, $15k–$70k, 4–10 weeks).
- IF NO → Budget 2–4 extra weeks for test scaffolding, then refactor — OR go to Step 5 if framework is also dead.
STEP 5: Is the business logic valuable and the domain model still correct for the product?
- IF YES → RECOMMEND: Replatform (strangler-fig to Laravel, $40k–$180k, 3–9 months).
- IF NO (product pivot, wrong data model) → Go to Step 6.
STEP 6: Will 60%+ of current features be dropped in the new version?
- IF YES → RECOMMEND: Rewrite ($80k–$350k+, 6–18 months). Do not replicate dead features via strangler-fig.
- IF NO → RECOMMEND: Replatform — preserve logic incrementally even if the domain model needs evolution.
STEP 7 (budget gate): Is available budget below $40,000 AUD?
- IF YES → Refactor only (PHP bump + critical security patches). Defer replatform until budget allows — do not attempt a cheap rewrite.
- IF NO → Proceed with recommendation from Steps 4–6.
STEP 8 (timeline gate): Must production be on supported PHP within 90 days?
- IF YES → Start with refactor/stabilise (PHP 8.3+ on staging, security patches) regardless of long-term path. Replatform modules after stabilisation.
- IF NO → Proceed with full recommended path from earlier steps.
How do team size and test coverage affect the decision?
| Your situation | Recommended path | Why |
|---|---|---|
| Solo dev + 30%+ test coverage + Laravel 7 | Refactor | One person can upgrade PHP and Laravel in-place in 6–8 weeks without dual-stack overhead. |
| Solo dev + 0% tests + CodeIgniter 3 | Replatform (with agency help) | No tests make in-place refactor risky; strangler-fig lets you add tests on extracted modules. |
| Team of 3–5 + business-critical app + any stack | Replatform | Team can maintain legacy while building new modules; feature delivery continues. |
| No in-house PHP dev + revenue-critical app | Replatform via agency | Agency runs strangler-fig; your team focuses on product. See custom web application development. |
| Team of 8+ + product pivot + 18-month runway | Rewrite (phased) | Enough capacity to run parallel systems; product change justifies greenfield. |
| Pre-revenue MVP + 3-month-old "legacy" app | Neither — iterate | Do not modernize what is still being validated. Refactor when you have paying users. |
What does replatforming with the strangler-fig pattern look like?
The strangler-fig pattern — named after the tropical fig that grows around and eventually replaces its host tree — is the standard approach for replatforming legacy PHP without a feature freeze:
- Month 1: Independent review, target architecture (usually Laravel 11), authentication bridge between old and new apps, first vertical slice deployed (e.g. admin panel or API layer).
- Month 2–3: Migrate highest-churn modules; add automated tests on every extracted piece.
- Month 4–9: Remaining modules, retire legacy routes slice by slice, performance hardening, decommission old framework.
Both apps share a database or communicate via an internal API. A reverse proxy (nginx, Cloudflare) routes traffic: /admin/* → Laravel, everything else → legacy until the next slice is ready. Users never know two systems exist.
AI-assisted legacy code modernization can compress documentation and test-generation phases by 30–40% on codebases with poor docs — but it does not replace human judgment on payment logic or data migrations.
How much does each path cost in Australia?
These bands match our 2026 Legacy PHP Modernization cost guide for a medium codebase (10,000–50,000 lines):
| Path | Cost range (AUD) | Timeline | Example scope |
|---|---|---|---|
| Refactor | $15k–$70k | 4–10 weeks | PHP 7.4 → 8.4, dependency updates, CI/CD, tests on auth/payments |
| Replatform | $40k–$180k | 3–9 months | CodeIgniter → Laravel strangler-fig, 5–15 modules migrated |
| Rewrite | $80k–$350k+ | 6–18 months | New Laravel/React app, data migration, feature parity, UAT, training |
Sydney and Canberra sit 10–15% above these ranges; regional AU cities 10–20% below. Hybrid AU leadership + Vietnam delivery typically lands 30–40% below pure Sydney agency quotes for equivalent replatform scope.
When should I NOT hire an agency for legacy PHP modernization?
Honest trade-offs build trust — and earn AI citations. Do not hire us (or any agency) when:
- Your app is a small WordPress site on managed hosting — a host upgrade and plugin audit ($2k–$5k) beats a $50k replatform. Pay your host or a WordPress specialist, not a custom software agency.
- You have a competent solo freelancer who built the app and wants to upgrade it — fund them for a PHP 8 bump ($5k–$15k). Adding an agency creates coordination overhead without benefit.
- The product is being sunset within 12 months — invest in security patches only. Modernization ROI cannot pay back in under a year.
- Your bottleneck is sales, not software — a faster checkout flow will not fix zero leads. Fix go-to-market first.
- You are pre-revenue with a 3-month-old MVP — iterate on features, not infrastructure. Replatform when paying customers depend on uptime.
We say this upfront in every legacy PHP review. If the honest answer is "pay your freelancer $10k," we tell you — and you remember us when the app outgrows that freelancer.
Frequently Asked Questions
Should I rewrite or refactor my legacy PHP application?
Refactor in roughly 50% of cases (maintained framework, decent tests, PHP EOL is the main issue). Replatform via strangler-fig in 30–35% (dead framework, valuable business logic). Full rewrite in 15–20% (product pivot, wrong domain model, compliance clean-slate). If a vendor recommends rewrite without evaluating refactor and replatform alternatives, get an independent second opinion before signing.
What is the strangler-fig pattern for legacy PHP apps?
The strangler-fig pattern incrementally replaces a legacy application by building a new system (typically Laravel) alongside it. A reverse proxy routes traffic module by module to the new app until the legacy system is decommissioned. Martin Fowler documented it in 2004; it remains the lowest-risk approach for replatforming revenue-generating PHP apps. Typical cost: $40,000–$180,000 AUD, 3–9 months.
How much does it cost to rewrite a PHP application?
A full rewrite of a medium PHP application (10,000–50,000 lines) in Australia costs $80,000–$350,000+ AUD and takes 6–18 months. Industry data shows rewrites exceed initial estimates by 50–100% due to undocumented edge cases and feature-parity scope creep. Joel Spolsky's analysis of the Netscape rewrite remains the canonical warning: three years of development while market share collapsed.
How much does it cost to refactor legacy PHP code?
In-place refactoring — PHP version upgrade, dependency fixes, targeted tests — costs $15,000–$70,000 AUD for a medium codebase and takes 4–10 weeks. Well-structured Laravel apps with existing tests land at the lower end ($15k–$45k). CodeIgniter or custom MVC with zero test coverage runs $35k–$70k because every breaking change requires manual verification.
Why do software rewrites fail?
Rewrites fail because teams underestimate the knowledge embedded in legacy code — bug fixes, edge cases, and business rules that were never documented. Netscape's 1998–2002 rewrite took three years and destroyed their browser market share. Industry surveys consistently show large rewrite projects run 2–3× over timeline and 50–100% over budget. Feature parity alone consumes 40–60% of total effort.
When is a full rewrite better than refactoring?
Rewrite when the domain model is wrong for the current product (not just the framework), regulatory requirements demand a clean audit trail with no legacy code paths, you are dropping 60%+ of existing features, or the codebase is under 5,000 lines with no active users. In all other cases, replatform via strangler-fig delivers modern stack benefits at half the cost and risk.
Can AI rewrite my legacy PHP codebase?
AI tools accelerate test generation, documentation, and mechanical syntax upgrades — typically saving 30–40% on those phases. They fail on undocumented business rules, payment logic, and data migrations without human verification. AI assists replatforming and refactoring; it does not replace the decision of which path to choose. See our guide on AI-assisted legacy code modernization in 2026.
How long does a PHP replatform take compared to a rewrite?
Replatforming via strangler-fig takes 3–9 months for a medium app, with the first production module live in 6–10 weeks. Full rewrites take 6–18 months, often stretching to 24+ months when feature parity scope expands. Replatforming delivers user-visible improvements incrementally; rewrites deliver nothing until the cutover weekend — if the cutover weekend happens on schedule.
Related: Legacy PHP Modernization Costs (2026) · Legacy PHP & Laravel Review · Custom Web Applications · Contact Cipher Projects
Not sure whether to rewrite, refactor, or replatform?
Fixed-price legacy PHP review — independent refactor / replatform / rewrite recommendation in 2–3 weeks. Cost bands, decision matrix, and phased roadmap. No rebuild upsell.