The verdict in three sentences
For the IT director of a Berlin SME whose 2012 business tool still runs on PHP 5, with no automated tests or documentation, the status quo has become the riskiest choice: no security patches since 2018, hosts dropping obsolete versions, original developers gone. Incremental refactoring (50,000 to 90,000 EUR) is almost always better than a full rewrite (90,000 to 250,000 EUR), unless the data model itself no longer fits the business. Either way, freeze scope before signing: projects without a frozen scope overrun by 30 to 50% on average.
Refactor or rewrite: the 2026 comparison
Orders of magnitude for an application of 80,000 to 150,000 lines of code, Berlin vendors (2026 estimates).
| Criterion | Incremental refactoring | Full rewrite |
|---|---|---|
| Budget | 50,000 to 90,000 EUR | 90,000 to 250,000 EUR |
| Duration | 3 to 8 months, in batches | 6 to 18 months |
| App usable during the work | Yes, continuously | Old version frozen until cutover |
| Overrun risk | 10 to 20% | 30 to 50% without frozen scope |
| Business rules hidden in code | Preserved | To be rediscovered, the top source of bugs |
| Performance gain | 2 to 5 times after upgrading to PHP 8.3 | Varies with the new architecture |
| Relevant if | The data model is still valid | The business has changed deeply since 2012 |
At Kolonell, these projects fall into our complex applications range: 7,000,000 to 15,000,000+ FCFA (about 10,670 to 22,870+ EUR), with an initial audit, regression tests and a supported cutover.
The step-by-step refactoring plan
The safest method is the strangler fig pattern: replace the application module by module, with the old code still serving whatever has not migrated yet.
| Step | Content | Indicative cost | Duration |
|---|---|---|---|
| 1. Audit | Code map, dependencies, vulnerabilities, data volumes | 6,000 to 12,000 EUR | 2 to 3 weeks |
| 2. Safety net | End-to-end tests on the 20 critical user flows | 8,000 to 15,000 EUR | 3 to 4 weeks |
| 3. Version upgrade | PHP 5 to PHP 8.3, replacing removed functions (mysql_*) | 12,000 to 22,000 EUR | 4 to 8 weeks |
| 4. Framework | Gradual migration to Symfony or Laravel, module by module | 18,000 to 30,000 EUR | 2 to 4 months |
| 5. Infrastructure | Containers, automated deployment, backups | 6,000 to 11,000 EUR | 2 to 3 weeks |
Signals that demand action in 2026
- Hosting: most shared hosts no longer offer PHP 5, and extended support fees are soaring.
- Security: SQL injection and insecure sessions are common in code from that era.
- Hiring: a freelance PHP developer willing to maintain untested legacy code costs 700 to 950 EUR a day in Berlin.
- Compliance: an incident affecting customer data exposes the company under GDPR, with the Berlin data protection authority as regulator.
Mini case study
Illustration: Lukas, IT director of a fictional 120-employee wholesale SME in Berlin-Spandau, pays 30,000 EUR a year in corrective maintenance and 8,000 EUR for special hosting on a PHP 5 tool. He is torn between a rewrite quoted at 180,000 EUR and a refactoring at 75,000 EUR. With a likely 40% overrun, the rewrite would actually cost about 252,000 EUR. The refactoring, even with a 15% overrun, comes to 86,250 EUR and brings maintenance down to 12,000 EUR a year: the 26,000 EUR in annual savings repays the project in just over 3 years, versus nearly 10 years for the rewrite.
Need a professional website?
Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.
FAQ
Can we keep the same database?
In 80% of cases, yes, with targeted fixes (indexes, UTF-8 encoding, foreign keys). It is one of the main advantages of refactoring over rewriting.
How long will the app be unavailable?
With incremental refactoring, a few hours per cutover, scheduled off-hours. A rewrite forces a single cutover, often over a weekend, with 1 to 2 weeks of stabilization.
Should we write tests before touching the code?
Yes. About twenty end-to-end tests on critical flows cost 8,000 to 15,000 EUR in Berlin and prevent most regressions.
When is a rewrite justified?
When more than 60% of screens or the data model must change, or when the app must become a multi-tenant product. Otherwise refactoring stays cheaper and less risky.
What should follow modernization?
Regular maintenance to avoid rebuilding debt: at Kolonell, 35,000 to 120,000 FCFA per month depending on service level, version upgrades included.
Let's scope your project. Send us your PHP version, approximate code size and critical modules: we propose an audit then a modernization plan from 7 to 15+ M FCFA, delivered in 4 to 8 week batches. 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.

