AI-assisted legacy PHP modernization: faster, cheaper and without betting the business
Author: ArcodoPublished: Updated: 6min read
Many companies still run on a PHP application written ten or fifteen years ago. It works and it pays the bills, but every change takes longer than it should. It runs on a PHP version that no longer gets security patches, and the few people who understood it have moved on. A full rewrite sounds tempting, yet it is also the classic way to burn a year’s budget and end up with a system that does less than the old one.
AI coding tools have changed the economics of this problem. They do not make modernization automatic, but they shift where the time goes. This article explains what that means in practice, what is realistic to expect, and which risks you still have to manage.
Why legacy PHP modernization used to be so expensive
The hard part of modernizing an old application was never typing new code. It was understanding the old one. A typical legacy PHP codebase has:
- business rules buried in controllers, templates and SQL queries, often duplicated in several places;
- no automated tests, so nobody can prove that a change did not break something;
- outdated dependencies and frameworks (Zend Framework 1, early Yii, CodeIgniter or custom code) that newer PHP versions no longer support;
- little or no documentation, and knowledge that lives in people’s heads.
Before anyone could safely change a line, an engineer had to read thousands of lines of unfamiliar code and reconstruct what it does. That analysis phase is slow, hard to estimate and easy to underestimate. Most of the cost and most of the schedule risk sits there.
Where AI genuinely helps
Modern AI assistants such as Claude Code, GitHub Copilot or OpenAI Codex are good at reading large amounts of code and explaining it. Used by an experienced engineer, they speed up exactly the parts that used to be the bottleneck.
1. Mapping the existing system
An AI assistant can walk through a module and produce a first draft of its documentation: which entities exist, where a given business rule is implemented, which parts of the code touch the invoicing logic. The engineer still verifies every claim, but it is much faster to check a map than to draw one from scratch.
2. Writing characterization tests
Before changing legacy code, you want tests that capture what it does today, bugs included. These are called characterization tests. Writing them by hand is tedious, so they are often skipped, and skipping them is what makes migrations dangerous. AI tools generate this kind of test quickly, and a developer then reviews and tightens them. The result is a safety net that would otherwise often not exist at all.
3. Repetitive, mechanical upgrades
Moving from PHP 7 to PHP 8, replacing deprecated functions or converting old array syntax is largely mechanical. Here AI works together with deterministic tools like Rector and PHPStan: Rector applies well-defined transformations, static analysis catches type errors, and the AI assistant handles the cases that do not fit a rule. You can see how these tools fit together on the technologies page.
4. Incremental migration to Laravel
A “big bang” rewrite is rarely the right call. A safer pattern is to run the new Laravel application next to the legacy one and move features over module by module, behind the same URLs. AI speeds up translating each module, while the overall structure stays a deliberate architectural decision made by people.
What AI does not do
It is worth being clear about the limits, because overpromising here is how projects go wrong.
- AI makes mistakes that look plausible. An assistant can confidently describe a function incorrectly or generate code that compiles but handles an edge case differently. Every change must be reviewed by an engineer who understands the domain.
- It does not know your business. Why does the discount rule have that strange exception for one customer group? The code will not tell you. Someone from your side still needs to answer those questions.
- It does not replace architecture decisions. Where to draw module boundaries, how to migrate data, and what to retire instead of porting are judgment calls.
- It does not remove the need for tests. If anything, AI makes tests more important, because they are how you verify that generated changes are correct.
So AI does not make modernization free, and it does not let an inexperienced developer safely migrate a critical system. It makes an experienced team noticeably more productive in the slowest phases of the work.
Data privacy, GDPR and your source code
For European companies, and for anyone handling EU personal data, a fair question is: does our code or data end up in a third-party AI model?
The approach at Arcodo is straightforward:
- AI tools are used on source code, not on production databases; real customer data stays out of the prompts;
- for sensitive projects, the permitted tools and their settings are agreed in writing (for example, business plans where providers do not train on your data);
- secrets, credentials and personal data are stripped from anything shared with a tool;
- if your policy forbids external AI services entirely, the work can be done without them. The project will simply take longer.
The EU AI Act mainly regulates AI systems placed on the market and their uses. Using an AI assistant to help write code is generally not a high-risk use, but it still makes sense to document which tools touched your codebase, and Arcodo does.
What this means for budget and timeline
Universal percentages would be misleading, because the gain depends heavily on the codebase. A well-structured but outdated application benefits differently than an untested tangle of spaghetti code. In practice, AI helps most with:
- shorter analysis, so you get an earlier and more reliable estimate;
- broader test coverage for the same budget;
- faster mechanical upgrades, so engineers spend their time on hard decisions.
Most importantly, it lowers risk. A migration that is covered by tests and done in small steps is far less likely to cause a costly outage than a rewrite that goes live all at once.
A practical way to start
If you are considering modernizing a legacy PHP system, a sensible first step is a short, fixed-scope assessment:
- a review of the code, the infrastructure and the deployment process;
- a list of the biggest risks (security, unsupported versions, missing tests);
- you get a written plan with options, from “keep and stabilize” to “migrate module by module”, and a rough estimate for each.
That gives you a basis for a decision before you commit to a large budget. You can read more about this approach on the legacy PHP modernization page.
Summary
AI does not modernize legacy PHP on its own, but it changes the cost structure of the work. Analysis, tests and repetitive upgrades get faster, and engineers can focus on architecture and on the business rules that really matter. The conditions are the same as always: experienced people, tests and human review of every change.
If you want to add AI-powered features to the modernized application later, read how to add AI features to your web app. If you are wondering how AI-assisted development affects quality and cost on your project in general, see what AI-assisted development means for your project.
Have an old PHP application that is becoming a liability? Describe it here. The first consultation is free and comes with no obligation.