Backend
Legacy rescue is not about rewriting. It is about making the next change safe. The first week is spent getting visibility: error tracking, a staging environment that mirrors production and a backup you have restored at least once.
Then I draw a line around the critical flows, usually login, checkout and whatever makes money, and write characterisation tests for them. Those tests do not judge the code; they capture what it does today so I notice when it changes.
Only then does refactoring start, one slice at a time: extract a service class, add a form request, move a query into a repository, upgrade a dependency. Each slice ships on its own, behind the tests.
Upgrading PHP and Laravel versions comes last, once the dangerous code is isolated. By then most upgrade errors point at code you have already cleaned, and the client has been getting improvements every week instead of waiting for a big bang.

The rescue order
01. See
Error tracking, logging and a real staging environment.
A restore test of the backups before touching anything.
02. Protect
Characterisation tests around the flows that make money.
A CI pipeline that runs them on every pull request.
03. Improve
Small, reviewed refactors shipped weekly.
Framework and language upgrades once the risk is contained.



