I just joined company where has a big project on the live server which needs to implement new functionality. But the problem that it’s running on PHP 5 and Laravel 5. I think before expanding functionality I have to update it to the newest version of Laravel and finally update it to PHP 7. What is the best way to do it? Try to set it up locally and go from there? Or better to use docker? Maybe anybody has some tips on what I should have in mind while updating Laravel versions? As I know everything is in the documentation and you have to update it one by one. For example from Laravel 5 to Laravel 5.1 and so on.
Thank you for your help
2
Answers
Follow the Laravel upgrade guide step-by-step:
https://laravel.com/docs/5.0/upgrade
For each version from 5.0 to 5.8, there’s a guide to upgrade version by version. You have to do them one-by-one, like 5.0 to 5.1, then 5.1 to 5.2, etc etc. Once you get to 5.8, it goes 5.8 > 6.x, then 6.x to 7.x
It’ll be a big endeavour to upgrade from 5.0 to 7.x (current), but it’s doable. Alternatively, there’s paid services, like Laravel Shift (https://laravelshift.com/) that will do it for you.
It depends on code structure and how deep is connected with Laravel. There is some helper functions for example which are deprecated. Some functionality is moved to separate packages
Step 1: Write tests for current version. Try to test as much is possible from current code
Step 2: Make a new installation of Laravel
Step 3: Move your controllers, models, migrations and tests to new installation
Step 4: rename helper functions… for example: array_get() to Arr::get()
Step 5: Start running tests and debug. Still Laravel upgrade guide may help here.