Running Laravel on top of a legacy PHP codebase
Modernised a native-PHP, directory-routed product in place, without a rewrite and without downtime for 200+ clients.
- 5.6 → 7.4
- PHP upgrade for new clients
- 1 login
- single sign-on across the app
- Self-hosted
- WebSockets replacing paid Pusher
The problem
The product was native PHP on an end-of-life runtime, with directory-based routing and schema changes applied by hand in production. A rewrite wasn’t realistic, but the codebase needed modern foundations.
Approach
- 01
Start with migrations
Introduced version-controlled database migrations, which ended manual production schema edits and gave Laravel its first foothold.
- 02
Replace auth and session
Swapped the legacy auth and session layers so Laravel runs underneath the old code. One auth provider, one login.
- 03
Open the platform up
Added API routes (JWT, OAuth2), middleware, queues, schedulers, events and Redis caching, plus a containerised Soketi server for real-time notifications.
Outcome
Legacy code can now be ported gradually. The self-hosted notification centre serves every client and cut third-party costs significantly.
What I took awayYou can modernise a live system one layer at a time if each step pays for itself.