The verdict in three sentences
In most cases, incremental refactoring at USD 33,000 to 88,000 (about €30,000 to €80,000) over 12 months secures an ageing PHP 5 application at far lower risk than a full rewrite at USD 99,000 to 275,000 (about €90,000 to €250,000). A rewrite is only justified if the business model has fundamentally changed or if less than 30% of the code is reusable. The status quo is the most expensive option over time: PHP 5 has received no security patches since 2019, and depending on a single developer is a business continuity risk.
The real cost of the status quo
The CIO of a Toronto distribution group runs an order management application written in PHP 5.6 twelve years ago: 180,000 lines of code, no automated tests, an in-house framework and one developer who understands how it works. Doing nothing looks free. It is not.
| Risk item | Current situation | Estimated 2026 annual cost |
|---|---|---|
| Hosting on an unmaintained PHP 5 server | paid extended support or isolated server | USD 4,400 to 9,900 |
| Manual security patching | known flaws not fixed upstream | USD 6,600 to 16,500 |
| Slow changes (3 to 5 times longer) | extra development cost | USD 16,500 to 44,000 |
| Single-developer dependency | resignation, sick leave risk | not quantifiable, critical |
| Security incident (10% to 20% yearly probability) | average SME incident cost | USD 55,000 to 165,000 |
| Blocked integrations (API, payments, SSO) | postponed projects | lost revenue |
As an order of magnitude, the status quo costs USD 27,500 to 70,000 a year in direct spending, before even counting incident risk.
Incremental refactoring or rewrite: the comparison
Incremental refactoring follows the strangler fig pattern: the application is migrated module by module to a recent PHP version and a standard framework (Laravel or Symfony), staying in production at every step. A rewrite starts from a blank page, often with a different technology.
| Criterion | Incremental refactoring | Full rewrite |
|---|---|---|
| Budget | USD 33,000 to 88,000 | USD 99,000 to 275,000 |
| Duration | 9 to 12 months, in phases | 12 to 24 months |
| Releases | continuous, module by module | single cut-over, big-bang risk |
| Regression risk | low, covered by added tests | high (forgotten business rules) |
| Feature freeze | no | often 6 to 12 months |
| Technical outcome | PHP 8.3, Laravel or Symfony, 60-70% test coverage | new architecture, stack of choice |
| Observed failure or overrun rate | 10% to 20% | 40% to 60% budget overrun |
The main danger of a rewrite lies in implicit business rules: 12 years of edge cases coded without documentation. Recreating them faithfully often takes twice as long as planned.
Decision criteria
Before deciding, a 5 to 10 day audit (USD 4,400 to 9,900) measures the state of the code and the functional relevance of the application.
| Criterion measured in the audit | Lean towards refactoring | Lean towards rewriting |
|---|---|---|
| Share of reusable code | over 50% | under 30% |
| Fit with current business | processes have not changed | new business model |
| Database | consistent, migratable schema | inconsistent schema, duplicated data |
| Blocking dependencies | replaceable one by one | abandoned PHP extension at the core |
| Users | interface accepted | UX redesign essential |
| Available budget | under USD 110,000 | over USD 165,000 and 18 months |
A hybrid approach is common: refactor the core (orders, invoicing) and rewrite only the user interface as a modern front end, for an intermediate budget of USD 66,000 to 132,000.
Need a professional website?
Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.
Mini case study
Thomas, CIO of a distribution group in Toronto, commissions a 7-day audit for USD 6,900. Result: 65% of the code is reusable and the business model has not changed. He chooses a 4-phase refactoring for USD 75,000 over 11 months, against a rewrite quote of USD 203,500 over 18 months. The status quo was costing him about USD 46,000 a year (isolated hosting, patches, slowed changes). After refactoring, these costs fall to about USD 13,000 a year, a USD 33,000 annual saving. The total investment (USD 81,900) pays back in two and a half years, and two more developers can now work on a standard Laravel codebase.
FAQ
Can we simply upgrade from PHP 5 to PHP 8 without refactoring?
Rarely. Removed functions (mysql_*, ereg, each) and typing changes break a large share of old code. A version upgrade alone already costs USD 16,500 to 44,000 on a 100,000-line codebase.
How much does adding tests to an untested application cost?
Characterisation tests on critical flows (orders, invoicing, stock) cost USD 8,800 to 22,000. They are the prerequisite for any safe refactoring.
What if the only developer leaves during the project?
The project's first action is to document the architecture and critical business rules over 2 to 4 weeks, and to pair a second developer from the very first phase.
Should we switch language, for example to Node.js?
Only if the team and ecosystem justify it. PHP 8.3 with Laravel or Symfony performs well, and staying on PHP avoids rewriting 100% of the code and hiring for a different skill set.
How long will the application be unavailable?
With incremental refactoring, no planned downtime beyond 1 to 2 hour maintenance windows per phase. A rewrite requires a single cut-over, often preceded by 2 to 4 weeks of double data entry.
Let's scope your project. Send us your PHP version, code volume and critical modules: we start with a 5 to 10 day audit, then price a refactoring between USD 33,000 and 88,000 or a rewrite if it is justified. Detailed quote within 48 h. WhatsApp +221 77 596 93 33.
Mohamed Bah
Fondateur, Kolonell
Passionate about digital and entrepreneurship in Africa, Mohamed has been helping Sénégalese businesses with their digital transformation since 2020. Founder of Kolonell, he believes every SME deserves a professional and accessible online présence.
