A new PHP version is released every year, that brings new features, removals, as well as breaking-changes that can be overwhelming for PHP applications that didn't keep up to date for a while.

Still running that PHP 5.4 application with no Composer autoloading in sight? Stuck in PHP 7.4 because PHP 8.0 is too steep of a jump? Tired of "if it works don't touch it" mantra? This talk might be just the right fit!

The more PHP evolves, the harder it can get to keep up with the latest changes in PHP. At the same time, almost every new PHP version brings performance and security improvements that legacy applications miss.

This talk borrows the wisdom of Desmond Tuto on how to eat an elephant ElePHPant: A bite at a time. Rewriting a PHP application entirely, especially when it's a legacy PHP application with a lot of edge cases can end up in a worse code, so the ideal way of modernizing a PHP application would be selectively upgrading it. Taking examples from Drupal 7's major upgrade to the modern Drupal code base today, as well as other practical and real-life use cases, this talk aims to be actionable, practical, and inspiring.

Some of the approaches and steps discussed in this talk include:

- Gradually adding proper error and exception handling
- Integrating a Dependency Injection Container
- Moving away from static PHP URLs and web-server URL rewrites to a single route handler design
- Incorporating Composer while getting rid of random scattered `include/require` directives
- Configuration management and separation
- Making code composable
- Using Object-Oriented Coding patterns where appropriate
- Gradually integrating templating systems

Additionally, this talk also discusses about lengthening the lifetime of legacy PHP applications in case the applications are not planned to be upgraded, and are only necessary to be run as long as they securely can be. Most of the inspiration for this section of the talk is from the speaker's blog post on [How to extend lifetime of legacy PHP applications](https://php.watch/articles/extend-lifetime-legacy-php)

What you'll learn from this talk:
How to upgrade legacy PHP applications without having to rewrite them entirely. It introduces some of the more recent concepts and design patterns that PHP 5-era PHP applications did not have back then, and discusses how to incorporate them into existing applications almost seamlessly.

Comments

Comments are closed.

Bas at 21:05 on 14 Oct 2023

At my current job we in the middle of this process. It was interesting to see a similar approach. What the talk really would make it great is more insights on the hurdles to overcome during this refactoring.

Paul at 11:31 on 15 Oct 2023

The talk was great, but it was a more or less beginners talk. Nevertheless informatvice

Tim Hofman at 14:43 on 19 Oct 2023

Your introduction was great and the tips you gave were also great, but there were a lot of details. I'd recommend to keep the tips short and shallow. It will maken your talk shorter, but with a clearer goal.