Experience the version upgrade of laravel
Sep 9, 2020
PHP
MySQL
Laravel
version upgrade
![laravel_varsionup.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/569093/2ccdd69b-ad6f-bfa2-5db3-f45032f2ac46.jpeg)
Introduction
I am a free PHP engineer.
I recently had the opportunity to work on a project to upgrade Laravel from var5.2 to var6, and I’ve summarized the experience I gained there, albeit roughly. I hope it will be helpful for those who are planning to upgrade from now on!
In addition, it was a version upgrade in an environment where the implementation of the test code is not so much, but if you are writing the test code properly, it is recommended to check it by turning the test!
Basically, it is good to proceed by looking at the published Update Guide.
Check
- -Server –Check laravel documentation, server requirements
- -mysql –Check the version
- -PHP –Check the version
- -PHP library –Check if it works even after the version upgrade. Check if the existing system works properly when you have to upgrade the library version –Please note that some libraries may not support it after upgrading Laravel.
- -laravel helper function ――When you upgrade the skipping grade, the contents have changed a lot, so be careful when using it.
- -collection –Method content changes, obsolete methods, etc.
- -Eloquent Query Builder –Eloquent may have a higher adoption rate, but be careful of both when using it in a mixed manner.
- -jobs failed_jobs table change –Since 5.3, the table structure of jobs and failed_jobs has changed.
- -Laravel Mix –Check the version when css and js are compressed
- -Session –Since 5.3, you can no longer access the session in the constructor
- -Instantiation ――I think that there are many places using DI now, but if you are instantiating with app and passing a variable, you will get an error unless you specify the key and pass it.
- -Log –In the case of a skipping version upgrade, be aware that the functions have been enhanced and the setting method has changed. When the error log is skipped to slack etc.
- -If you are overriding under vender ――This is the biggest bottleneck in the project I was involved in. You may not do much, but sessions and auth , Others If you override the method under vender and add your own processing, it is better to think that it basically does not work.
Depending on the project, there may be more places to check, but it’s a good idea to consult with someone who has a good understanding of the system!
Before running the version upgrade project
It is a good idea to list the notes. For example, if you need to upgrade PHP and use PHP functions frequently, there are some functions that are deprecated, so what kind of measures are required as compensation to unify such list and correction contents. If you leave it, it will be easier to move as a team.
We also recommend that you list the required work.
##Finally It’s easier to upgrade if you write the test code on a regular basis: tada :!