Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pilat's avatar
Level 41

How to work on different version of laravel?

Hi, I have Laravel 5.3 project locally.

There is also upgrade to Laravel 5.8 in progress.

When I do the upgrade, I switch to 'upgrade' branch, when I have to hit-fix anything in current version — I switch back to 'master'.

The problem is: I need to re-build all dependencies (composer + npm) every time I switch between branches, because both those folders are not in the CVS.

How does anyone addresses this problem?

0 likes
4 replies
jasonmccallister's avatar

@pilat I think your approach is the right way to go. However, there are always alternatives.

One alternative would be to start a new repository and move the models, controllers and etc over one at a time but it sounds like you are already in the process of upgrading.

To make things easier, it might be helpful to place a bash script in your directory to install composer and node dependencies in one command, something like deps when you are switching back and forth.

pilat's avatar
Level 41

@THEMCCALLISTER - Thnk you. At the very moment I've almost finished the upgrade (remaing changes are updating client code that uses guzzlehttp/guzzle and maatwebsite/excel libs, as they have received major updates). However, I still need to switch back and forth.

So, currently I'm trying an approach with having two separate directories: in one I'm in the master, in anther — I'm int the e `upgr branch. I'll try to report if there are any drawbacks.

1 like
pilat's avatar
Level 41

Concerning the upgrade itself: I personally have found the following way is the most "thorough":

  1. Do it one version at a time. I.e., 5.3 to 5.4, then 5.4 to 5.5 and so on.

  2. Bring over all the changes from github's comparison tool. Example: https://github.com/laravel/laravel/compare/5.3...5.4 (then switch to File changes tool). Usually, this covers majority of changes.

  3. Go through "Upgrade guide" to find any changes you'd like to bring over to your client code (such as Cache now uses number of seconds instead of minutes and etc — you'll not catch those via github comparison tool)

  4. Go through "What's new in Laravel v5.{target}" videos — there were, actually, couple of points those videos brought to my attentions that I haven't caught through previous steps.

1 like
jasonmccallister's avatar

I know this is late, but Laravel Shift would perform a lot of this for you. I haven’t used it and understand your approach because it makes perfect sense to me!

Please or to participate in this conversation.