Legacy modernization · Guide

How do you move a legacy PHP app to Laravel without a big-bang cutover?

· Published

Rebuild beside the old app while it keeps running. Work out its rules from the code, check the new app against the live one, trial the data import early, put one gym on it first, and switch over gradually. That's how we moved SkillTrakker, an app for gymnasts and their parents, from framework-less PHP with a database per gym to one Laravel and Angular SaaS, between 2020 and 2022. This page is the method; the whole story is in the SkillTrakker case study, and more of this kind of work is on our legacy modernization page.

1. What we started from

By May 2020 the old app had 121 PHP files of its own. Only two defined a class, and none used namespaces. One file had grown to 4,865 lines and held most of the logic: 73% of the app's functions and over half its SQL. Most files mixed markup with PHP, and 25 of the 121 called the database directly. There were no tests.

Each gym had its own login and its own database, all with the same structure. A change to the database meant running the same script by hand on every gym's database.

2. Signs it was time to rebuild

We didn't start with a rewrite. In 2019 we added an autoloader and centralized the database references. By mid-2019 a move to a framework like Laravel was already the stated goal, and we pushed for it. Louise, who led the project then, gives two reasons. Each new feature cost more than the one before it. Louise logs her time on nearly everything. One change on the old app took at least four times what a harder feature took her on a well-structured project. And the code had become very hard to hand over cleanly to anyone.

Kevin, who has led the API since its first commit, names what weighed most: "the decision to make it one multi-gym app instead of a separate database per gym, and the slow features."

3. Rebuild for one app, not many

The 2020 plan called the new app "Software as a Service": every record and every URL belongs to a gym, and each gym gets its own settings: its leaderboard, certificates, payment system and colors. One app holds every gym.

For the stack, Louise and the team chose what they knew: a Laravel API and an Angular front end, so we could start fast. Angular comes with routing, forms, state management and per-component styles built in, each done one way, which she says suits a system that will grow. PostgreSQL replaced MySQL with the feed in mind, in case it ever grew into something more like a social network. Its triggers turned out to matter as well: by early 2022 they computed the app's points and streaks.

4. Recover the rules from the old app

In May 2020 we wrote nine use cases: signing in, resetting a password, creating an account after paying, completing a challenge with an optional photo or video, and the points, streak, feed post, notifications, reactions and comments that follow. The new screens came from them and from reverse-engineering how the old app behaved. The team read the old PHP to recover how challenges and points really worked, and checked the new app side by side against the live one through 2021.

The front end was built from scratch, with the same theme and visuals, improved in places. Matching the old behavior exactly "was never quite perfect", Kevin says, so many parts were rewritten from scratch "to give the same result, done better".

5. Move the data in trials, then one gym first

If I have to recall the hardest part of rebuilding, without doubt, this was it.

Kevin, API Lead

Kevin counts this, with rebuilding from the old app, as the hardest part. Even learning how the old app behaved was slow, in a test environment "limited by its many errors". In the old databases, several key tables had no relationships at all, and some records existed twice. Every gym's database had the same structure, so ids collided "in many cases". The risk, in Kevin's words, was "assigning data to the wrong place: the skills, events and categories of each skill list, and how they relate to users", because "most of SkillTrakker is about linking sections to each other".

What we did:

  • Resumable imports. The import scripts read the old databases and wrote each new id back to the old row, so a run could stop and pick up again. They carried users, gymnasts, rosters, skills, progress, challenges, the feed and scores.
  • Trials with real data, early. A run with production data in October 2021 hit "inconsistencies in the database". Another, by early February 2022, left visual errors to fix.
  • Every gym's people, then one gym first. In March 2022 the import brought every old gym's people into the one app. A pilot gym was using it by the end of March, and real users were on it by early May. By June 2022 production ran on the new app.
  • What the users had built came with them. Each gymnast's streak came across with its count and its last day, and the new app kept counting by the old rule. The longest streak on SkillTrakker began on the old app; on 17 November 2026 it was 2,949 days, by the app's database.
  • The client checked it too. We compared most of the data against the old app while it was still live, and the owner reviewed the new app herself before the switch.
  • The old app stayed live, and we kept maintaining it.

6. What it cost, and what we'd change

It took time. The new API's first commit was in August 2020; production ran on the new app by June 2022, nearly two years later, with the old app maintained the whole way. And it was never a perfect copy of the old behavior.

I'd document the old app's rules in more detail from the start.

Kevin, API Lead

What we'd change comes from Kevin. "Much of the investigation happened while we were already rewriting," he says. Had the rules been on paper first, the tables with no relationships and the duplicates would have made sense sooner.

7. What came after

For long stretches the rebuilt app has run on a small set of changes each month, with anything bigger coming as a proposal, ours or the client's. In 2025 and 2026 we upgraded its back end and front end several major versions, one at a time, and the 2026 features were built on it.

Case studyFrom the case study: SkillTrakkerThe whole story of the partnership behind this rebuild, from 2018 to the 2026 redesign.Read the case study
Stuck on an old PHP app? Let's talk about getting off it.Start your project
.