Legacy PHP Modernization vs Rewrite: How to Decide Without a Costly Mistake

Legacy PHP modernization vs rewrite decision guide next to Prashant Singh at his desk, showing how many rewrite answers point to modernizing in place, a strangler fig rebuild or a full rewrite

Legacy PHP modernization vs rewrite is the choice you face when a developer opens your old PHP app and sends back a quote for a full rebuild. W3Techs data for 30 November 2026 shows that 30.2% of websites using PHP still run PHP 7 or older, on its PHP usage statistics page (retrieved 2026-11-30). Plenty of those sites still take orders and run daily work for the businesses that own them. For a lot of them, an upgrade in place costs less and carries less risk than starting again.

I’m Prashant Singh. I’ve built PHP and Laravel apps for clients since 2014, and I’ve taken over existing codebases that needed restructuring. This guide gives you seven questions to answer before you sign a rewrite quote, plus a simple way to score the answers. It is part of my larger guide on adding AI to an existing Laravel app without a rewrite.

Key Takeaways

  • About 41% of websites that use PHP run a version with no security fixes, by my count from W3Techs figures for 30 November 2026. An old version means the app needs an upgrade, and the size of the version gap sets the size of that job.
  • Modernizing keeps the app live while your developer upgrades it in small, tested releases.
  • The strangler fig approach replaces one section of the app at a time behind the same domain, so even a rebuild can go live in small parts.
  • A full rewrite makes sense when the database no longer fits the business, or when nobody can explain what the code is meant to do.

Legacy PHP Modernization vs Rewrite: What Is the Difference?

Modernization keeps the code you already have. Your developer moves it to a supported PHP version and cleans it up in small releases while customers keep using the app. A rewrite starts a new codebase, often in Laravel, and moves users across once the new version does everything the old one did.

Martin Fowler named a middle path the Strangler Fig, after a vine that grows around a host tree until it can stand by itself. New code takes over the old app one section at a time behind the same domain. Fowler’s Strangler Fig article (retrieved 2026-11-30) describes the plan of building a new system that does exactly what the old one does, and then says: “we’ve seen this simple-sounding plan go down in flames most of the time.”

ApproachWhat happens to the old appNew features during the workBiggest riskFits when
Modernize in placeStays live and gets upgraded step by stepKeep shipping, a little slowerAn upgrade step breaks a page nobody testedThe database still fits and someone understands the code
Strangler figStays live and shrinks one section at a timeShip them in the new sectionsTwo codebases to run for a whileOne part of the app is past saving and the rest works
Full rewriteFrozen, then switched off on launch dayMostly on hold until launchBusiness rules the old code handled get lostThe business has changed beyond what the old data model can hold
The three ways to deal with a legacy PHP app, side by side.

How Many PHP Websites Run Unsupported Versions?

About 41% of websites that use PHP run a version that no longer gets security fixes, by my count from W3Techs figures for 30 November 2026. W3Techs puts version 7 at 23.1% of PHP sites and versions 5 and 4 at 7.1% together. On its PHP 8 page (retrieved 2026-11-30), versions 8.0 and 8.1 make up 16.1% of PHP 8 sites, which adds another 11.2% of all PHP sites.

Every one of those branches is past its end date on PHP.net’s list of unsupported branches (retrieved 2026-11-30). PHP 7.4 reached end of life on 28 November 2022, and 8.1 followed on 31 December 2025. The 8.2 branch gets its last security fix on 31 December 2026, per the Supported Versions page. Unless their owners upgrade, another 16.8% of PHP sites join that group in January.

PHP 8.3 to 8.6 Supported into 2027 or later 41.7% PHP 8.2 Last fix 31 Dec 2026 16.8% PHP 8.0 and 8.1 8.1 ended 31 Dec 2025 11.2% PHP 7 7.4 ended 28 Nov 2022 23.1% PHP 5 and 4 5.6 ended 31 Dec 2018 7.1% Supported Support ends this month No security fixes
Share of PHP websites by version on 30 November 2026. My grouping of W3Techs figures (PHP and PHP 8 pages), with end dates from PHP.net, all retrieved 2026-11-30.

How big the upgrade is depends on how far behind the app sits. Laravel’s upgrade guide estimates 10 minutes for a current app moving from Laravel 12 to 13 (retrieved 2026-11-30). An app still on PHP 5.6 needs more work, because PHP 7.0 removed the old mysql extension, per PHP.net’s PHP 7.0 migration notes. Every mysql_query() call has to move to PDO or mysqli. That is a long search-and-fix job, and the business rules around those queries stay as they are.

If the server’s PHP needs updating as well, my PHP2Shell patch guide shows how to update PHP on a Linux server and confirm which version the site runs.

Which 7 Questions Decide Between Modernizing and Rewriting?

Answer these with your developer, with the app’s real code and database open. Each answer leans towards keeping the app or replacing it, and the scoring table after the seventh question turns the answers into a decision.

1. Does the app run part of your business every day?

If staff or customers use the app daily, a rewrite means months in which new features wait while the new version catches up with the old one. Modernizing lets you keep shipping during the upgrade. For an internal tool that a few people open once a month, that waiting costs much less.

2. Does the database still match how the business works?

Your developer can clean up messy code one file at a time as long as the tables underneath describe the business correctly. Trouble starts when the database was designed for a business you no longer run. A common case is an app built for one company that now has to keep separate data for many client companies. Prices stored as text are another. That part of the app is the strongest case for new code.

3. How far behind are PHP and the framework?

Run php -v on the server and open composer.json to see the framework version. Being one or two major versions behind on a framework like Laravel is routine upgrade work. A PHP 5 app with no framework and no Composer can still be modernized. Rector, an open-source upgrade tool, says on its website that it moves code from PHP 5.3 to 8.5 (retrieved 2026-11-30). Plan that jump as many small steps, with a test run after each one.

4. Can you tell whether the app still works after a change?

Many inherited PHP apps have no automated tests. Before any upgrade, your developer should write tests around the flows that take payments or send data to other systems. These tests record what the app does today, bugs included, so any change in behaviour shows up straight away. If nobody can write them because nobody knows the right result, count that as a rewrite answer for question 5 too.

5. Can anyone explain the business rules inside the code?

Old apps collect years of small rules, like a special discount for one client or a tax rule for one region. Modernizing keeps those rules running while the code around them gets upgraded, and a rewrite team has to find every one of them again before launch. Fowler’s article puts it this way: “Replacements seem easy to specify, but often it’s hard to figure out the details of existing behavior.”

If an agency built the app and the people who knew it have moved on, start with my guide on what to do when you inherit a Laravel app from an agency.

6. Is the slowness in the code or in a few heavy processes?

A lot of rewrite quotes begin with a slow app. On Let’s Calendar, a bulk calendar invite SaaS, contact import used to time out after about 15 minutes at around 5,000 contacts. I moved that one process into chunked background jobs with no rebuild, and the same server then imported 101,096 contacts in under a minute.

For slow pages, look for the N+1 query problem first. One eager-loading change can remove hundreds of queries from a single page.

7. What does the rewrite quote leave out?

Rewrite quotes tend to price the new screens and skip the move itself. Ask where the quote covers moving data out of the old database and redirecting every old URL. Check that it also prices each payment or CRM integration, plus the weeks when both apps run side by side. Anything left out turns into extra cost after you sign, so get each item priced in writing.

How Do You Score Your Answers?

Put each answer in one column of this table, then count how many landed under a rewrite.

QuestionPoints to modernizingPoints to a rewrite
1. Daily useStaff or customers use it every dayUsed rarely, or due to be retired
2. DatabaseTables match how the business worksDesigned for a business you no longer run
3. Version gapOne or two major versions behindPHP 5 with no framework and no Composer
4. TestsTests can be written around the payment flowsNobody knows what correct output looks like
5. Business rulesRules are known or can be traced in the codeRules are lost and the code can’t be followed
6. SpeedSlowness traced to queries or one processStill slow everywhere after those fixes
7. The quoteSkips data migration or redirectsCovers migration, redirects and every integration
Score sheet for the seven questions.
Answers in the rewrite columnWhat to do
0 to 2Modernize the app in place.
3 or 4Modernize, and use the strangler fig approach on the sections that scored worst.
5 to 7Plan a rewrite, and build it one section at a time.
The database question aloneRebuild the parts of the app that sit on the wrong tables, even if everything else points to modernizing.
How to read the score.

What Does Legacy PHP Modernization Look Like in Practice?

Legacy PHP modernization runs as a series of small, tested steps on a copy of the app, and each step goes live before the next one starts. This is the order I work in.

  1. Restore the live code and database on a separate server and get the copy running. My VPS setup guide for Laravel and PHP on Ubuntu covers the server side.
  2. Note the PHP and framework versions, and run composer audit if the app uses Composer.
  3. Write tests around payments and any data the app sends to other systems.
  4. Raise PHP one version at a time with Rector, running the tests after each step. Then do the same for the framework.
  5. Fix the slowest pages and the files staff complain about most, one release at a time.

For step 4, a small Rector config in the project root is enough to start:

<?php
// rector.php
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/app', __DIR__ . '/tests'])
    ->withPhpLevel(0);

Run vendor/bin/rector process --dry-run, review the diff, apply it and raise the level by one. Rector’s levels documentation says it only adds rules up to the PHP version in your composer.json, so the level never runs ahead of what your server supports (retrieved 2026-11-30).

How does the strangler fig approach work on a PHP app?

For an app with no framework, set up a fresh Laravel app on the same server and let the web server decide which one answers each request. Requests for one section, say /billing, go to Laravel. Every other URL still reaches the old PHP files. Both apps read the same database, so customers see one site while the old code shrinks.

Legacy PHP modernization vs rewrite middle path: diagram of the strangler fig approach, where the web server sends billing requests to a new Laravel app and every other request to the old PHP code, and both apps share one database
The web server splits traffic by URL, and the new Laravel app takes over one section at a time.

The same idea works one flow at a time inside a Laravel app. On AMRIOP, a receipt management SaaS, we rebuilt onboarding around single sign-on with a mailbox permission granted at sign-up. Receipts are now fetched and categorised automatically, and the manual steps per receipt went from four or five to zero.

When Is a Rewrite the Right Call for a Legacy PHP App?

A rewrite is right when your score points there, most often because the database no longer fits the business or nobody can say what the code is meant to do. My post on the signs a Laravel app needs AI automation, not a rewrite lists the foundation problems I check for.

A rebuild also needs a plan for the move itself. ArcticBlue, an Australian e-commerce store, was rebuilt on Laravel with an indexed data layer and reworked query paths. Average server CPU fell from about 60%, with peaks at 100% that took the site down during business hours, to about 5% on the same instance with no capacity upgrade. Its old domains return 301 redirects to the new one, which is how the store held on to the search value of its old URLs through the move.

Where Does AI Fit Into a Legacy PHP Modernization?

Rewrite quotes often arrive right after a business asks for a new feature, such as AI that reads documents or sorts email. The official Laravel AI SDK, laravel/ai 1.4.2, needs PHP 8.3 and Laravel 12 or 13, per its Packagist listing (retrieved 2026-11-30). Modernizing to Laravel 13 on PHP 8.3 is the same work that makes the SDK available. Until the upgrade lands, an older app can call an AI provider from a queued job through an HTTP client.

My guide to AI email triage for Laravel shows one such feature added to an app that already exists. At Manomay Informatics, automation I built with Zapier and the OpenAI API cut manual operations by 80% for enterprise clients. My AI automation case study shows how we measured that.

Frequently Asked Questions

How long does it take to modernize a legacy PHP app?

It depends on the version gap and on whether the app has tests. Laravel’s upgrade guide estimates 10 minutes for a current app moving from Laravel 12 to 13. A PHP 5 app with no framework and no tests takes far longer, because tests have to be written before each upgrade step. I give a timeline only after auditing a restored copy of the app.

Is PHP 7.4 still safe to run in production?

PHP 7.4 reached end of life on 28 November 2022, per PHP.net, so security holes found since then stay unpatched in it. Move to PHP 8.3 or newer. PHP 8.2 also stops getting security fixes on 31 December 2026.

Can you modernize a PHP app that has no framework?

Yes. Add Composer and use Rector to raise the PHP version step by step. New sections can go into a Laravel app on the same server, with the web server sending their URLs to Laravel and every other page to the old files.

Should you rewrite a PHP app in Node.js or Python instead?

Only with a reason beyond the age of the code. W3Techs shows PHP on 67.8% of websites whose server-side language it can detect, as of 30 November 2026. Switching language turns the job into a full rewrite, and your team has to hire for a new stack as well.

What should a rewrite quote include?

A plan for moving data out of the old database, a redirect map for every old URL, a list of integrations to rebuild and the length of time both apps run side by side. It should also name the person who checks that each business rule made it across.

Not Sure Whether to Modernize or Rewrite Your PHP App?

Send me the PHP version your server runs and, if you have one, the rewrite quote you received. I’ll go through the seven questions with you and tell you which way your app points. Message me on WhatsApp, or use the email and phone details on the contact page.


Sources