Automatically upgrade your Laravel app with Shift

Laravel Applications

January 5th, 2016

Automatically upgrade your Laravel app with Shift

Laravel Shift is a new project aimed at automatically upgrading out of date Laravel apps up to the current version. The way it works is you sign-in with either Github or BitBucket, purchase a shift (an upgrade package), and then review the pull request it automatically creates.

I had a chance to speak with Jason, the lead developer on the project and what follows is a Q&A about Shift:

Can you tell us where the idea for Laravel Shift came from?

This past fall I gave a presentation at PHP[world] titled All Aboard for Laravel 5.1. While doing research for my presentation, I was surprised at the lack of resources for upgrading Laravel. There were a few blog posts and of course, the official Laravel Upgrade Guide, but no migration tools. I’ve seen migration tools for other frameworks, so I thought, “I should build one for Laravel”. I pitched the idea to Taylor at the conference and he wasn’t aware of any tool either. So during the Hackathon Laravel Shift was born.

Is the upgrade routine completely automated?

Yes, Laravel Shift is completely automated from start to finish.

To start, you sign in with your GitHub or Bitbucket account, choose a shift, specify your repo, and place your order.

Once payment is received the Laravel Shift account is added as a collaborator to your repo and your shift is added to the job queue.

When the job is finished, a new branch containing the changes is pushed to your repo and a pull request (PR) with additional comments is opened for you to review the changes before merging.

Will it work on pretty much on any app? Or are there things to watch out for?

Laravel Shift will work on any app. However, it works best for apps that do things the “Laravel Way”. So if you’ve coded away from Laravel conventions or abuse the dynamic nature of PHP, there may be more manual work for you to do before merging.

It’s important to note this is by design. Laravel Shift is opinionated about the way it upgrades your app. This way after you merge the shift you know your app is upgraded and not in some hybrid state between the previous and the current version.

Have you had any that couldn’t be converted? What happens in that case?

Laravel Shift is currently in alpha. So I’m still shaking out the bugs. Only one I considered major. I push updates nightly and stay in contact with users during the alpha release in an effort to improve each shift.

Laravel Shift is pretty cautious. If it can’t reliably perform the upgrade automatically, it will leave a detailed comment on the PR so you can upgrade manually.

It’s also important to understand that Laravel Shift uses Git as its foundation. Everything is done on a separate branch and submitted in a PR. This way you have the chance to review and perform any additional changes before merging or close it if it didn’t meet your needs.

If there is an issue, users are encouraged to comment on the PR. This makes it easier to talk about the code since its in front of us. Twitter is also a way to check or report any issues – @laravelshift.

Before the final release, I plan to build a way to allow users to request their shift be rerun. This way there’s an immediate and automated way for you to resolve issues.

To go from Laravel 4.2 to the latest would you need to go through the process three times? 4.2 to 5.0, 5.0 to 5.1, 5.1 to 5.2, etc…

Yes, you would need to do all three shifts separately. This is by design. Even though some shifts are for minor releases, there’s still a lot being upgraded. Laravel Shift does more than what’s listed in the Laravel Upgrade Guide. Plus there’s other things to consider like package dependencies and new configuration options. So you really need to review before performing the next shift.


If you have a project that needs updating give Laravel Shift a try.

Filed in:

Eric L. Barnes

Eric is the creator of Laravel News and has been covering Laravel since 2012.