Upgrading Laravel 5.4 to latest version (5.7)
Solution 1
There are some articles on documentation. You can upgrade to 5.7 directly but be sure to modify critical sections from this links 5.5->5.6, 5.6->5.7. And make a backup of current project first
Solution 2
Better to upgrade 5.5 first an then go with 5.6 and 5.7 because if you see in 5.5 and 5.6 upgrade guide there are some packages also need to upgrade so you better go with the step by step.
For older versions, you can look at
Solution 3
From my point of view, it would help to upgrade step by step. This helps to to see whether your application is already compatible with all changes that need to be made.
If you upgrade to 5.7 directly and face larger problems due to the changes, your quickest option is to downgrade to 5.4 again.
If you upgrade to 5.5 in the first step, you can make your application compatible to 5.5, test it thoroughly, deploy it, and start to test what needs to be done for the upgrade to 5.6.
Solution 4
Just update your laravel/framework
dependency to 5.7.*
in your composer.json
file:
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0"
},
After, run this command on your command prompt: composer update
You will achieve success and your Larvael will change to version 5.7, more details are available on upgrade guide
Solution 5
Just update your laravel/framework dependency to 5.7.* in your composer.json file. Since you are upgrading from 5.4 to 5.7, then you can easily just run
composer update
And if you modified some of Laravel's Traits or Methods in your 5.4 application, then you can check here for more info
Michael
Updated on July 29, 2022Comments
-
Michael almost 2 years
I am working on Laravel 5.4 with PHP version 5.6.4. My goal is to upgrade my project to Laravel 5.7 with PHP 7.1.
Now my question is: Do I have to upgrade to 5.5 > 5.6 > 5.7 or can I go directly from 5.4 to 5.7?
-
Michael over 5 yearsHonestly I don't understand the upgrade documentation. Do I need to change the version in my composer.json file and do a composer update? Do I need to change the source code of the Laravel framework? Or is it just explanatory information on the upgrade documentation page?
-
Hamid Naghipour over 5 yearsIt's Ok. you need to go "composer.json" and edit "laravel/framework": "5.4.*", to "laravel/framework": "5.7.*" for upgrade laravel. befor that check in your command line your php version. other task there is step by step in document page . if you have any other question you can email to me, I help you
-
Michael over 5 yearsIf I do this then I get this error
Your requirements could not be resolved to an installable set of packages.
I have PHP 7.1.20 -
Udhav Sarvaiya over 5 years@Michael Please share the code of your
composer.json
file -
Nico Haase over 5 years....and share the exact error log. Most probably, it will tell you about the conflicting packages
-
Nico Haase over 5 yearsCan you explain further why one should not upgrade step by step? IMHO, it would help to resolve potential errors
-
Nico Haase over 5 years@HamidNaghipour Please run all communication here, such that others can make use of it. If you have anymore questions, feel free to open a new question
-
Hamid Naghipour over 5 years@NicoHaase It's about work together remote and It's not about questions. ok I remove my comments.