Modernisation · July 2026
PHP powers a large share of business applications in German SMEs. Whether ERP integrations, customer portals or internal administration tools — many of these systems were developed ten or fifteen years ago and still run reliably today on PHP 5.x or 7.x. The problem: they run reliably, but they do not evolve.
When companies today want to use AI assistants such as GitHub Copilot, Cursor or Claude Code to accelerate their development, these tools fail on precisely these legacy codebases. Missing type information, monolithic architectures and outdated language constructs make it almost impossible for the AI to deliver meaningful suggestions. The result: the AI hallucinates, produces faulty code or simply does not understand the context.
The good news: PHP can be modernised step by step — without a complete rewrite. In five concrete steps you make your codebase fit for AI-assisted development.
The most important first step is upgrading to PHP 8.2 or higher. Many companies shy away from this step because it is considered risky. In practice, however, the upgrade is highly plannable, especially when done incrementally: first PHP 7.4 as an intermediate stage, then PHP 8.0, then 8.2+.
Why is the version so decisive for AI-readiness? Modern PHP versions bring language features that AI assistants urgently need as context information:
string|int instead of vague PHPDoc comments. Precise type information means more precise AI suggestions.Through the version upgrade and the use of these features alone, the AI-Readiness Score of a codebase can improve by 20 to 30 percent — before a single line of business logic is rewritten.
Types are the most important context an AI can extract from source code. Without types, the AI must guess what a variable contains, what a function returns and which values a parameter accepts. With types, this guessing becomes unnecessary.
Introduction happens in three stages:
declare(strict_types=1) in every file. This forces PHP to apply strict type checks at runtime and uncovers hidden type errors.In practice we recommend starting with the most frequently used classes — typically models, services and controllers. Tools such as PHPStan at level 6 or higher help to systematically identify missing types. Every file that is fully typed is immediately better understood by AI assistants.
AI assistants work with a limited context window. A 5,000-line controller is just as incomprehensible to an AI as it is to a new developer. Modularisation is therefore not only good software engineering — it is a prerequisite for effective AI use.
The proven approach is the Strangler Fig Pattern: instead of replacing the monolith in one go, new, clean modules grow around the existing code until the old code is gradually replaced.
Concretely this means:
new calls in the business logic, dependencies are injected via the constructor. This makes classes interchangeable and testable — and gives the AI clear information about which dependencies a class has.Every extracted module is immediately a better target for AI-assisted development: manageable, typed and with clear interfaces.
Without tests, AI-assisted development is flying blind. When an AI suggests or refactors code, you need an automated way to check whether the result is correct. Tests are that safety net.
The pragmatic starting point:
phpunit.xml and a first test are enough to establish the infrastructure.For AI-assisted development, tests are doubly valuable: the AI can validate against the test suite, and you can verify AI-generated changes with a single command. In our projects we regularly see that a test coverage of 60 to 70 percent of the critical paths is enough to use AI assistants productively and securely.
The last step is often overlooked, but is decisive: you must explicitly tell the AI how your project is structured. Code alone is not enough — context makes the difference between usable and brilliant AI suggestions.
In practice we see: teams that have a well-maintained context file achieve up to three times better results with AI assistants than teams without explicit context — on an identical codebase.
A complete PHP modernisation is not a weekend project, but neither is it a multi-year undertaking. In practice we reckon with 4 to 12 weeks per module, depending on the size and complexity of the existing codebase.
The sequence is plannable:
Important for budget planning: modernisation projects aimed at digitalisation and AI enablement are often eligible for funding — for example through the programme „Digital Jetzt“ or state-specific digitalisation grants. We are happy to advise you on the current funding opportunities.
PHP legacy code is not an obstacle to AI-assisted development — provided it is systematically modernised. The five steps — version upgrade, typing, modularisation, tests and AI context — build on each other and each deliver measurable value in their own right.
You do not have to do everything at once. Each individual step improves the quality of your codebase and brings you closer to productive AI use. The most important step is the first.
Find out where your PHP project stands: Our free Quick Check analyses the current state of your codebase and shows you the concrete modernisation path.