Upgrading a laravel 5.4 project to laravel 7 - laravel

Is it even worth it upgrading a laravel 5.4 project to laravel 7 which includes many packages ?
Do I have to upgrade it manually version after version or is there any tool that might help with the migration ?
Thank you for all the answers.

By upgrading one version at time, it will be easier to fix and change whats needs to be changed.
Here is how I did:
https://laravel.com/docs/5.5/upgrade
Follow the guide
Change the code
Test your code
https://laravel.com/docs/5.6/upgrade
Follow the guide
Change the code
Test your code
And so on.
Depends on the size of your project. Go to the github pages of your third party packages to check if they have updated as well. You can always change the package.
It will be a pain in the ass, but it's possible.
(Don't forget the php version.)
Good luck!

Related

How to fix when I update composer on laravel

I trying to run my laravel 5 project on laravel 8. When I am trying to update my laravel composer. I am fetching this kind of problem.
In order to have enough coverage on the updates and changes that you need you have to look at at least 2 parts.
PHP
There will be breaking changes to the languages and updates that you would need to make in order to ensure consistent behaviours across the PHP versions. The following link should have the relevant guides to help you with this.
E.g. https://www.php.net/manual/en/migration70.php
Laravel
Look at the /upgrade portion of the Laravel documentation. You should be able to find them at https://laravel.com/docs/{version}/upgrade
E.g. https://laravel.com/docs/5.1/upgrade
Given the large number of version jumps, you might want to consider re-writing the application in a fresh Laravel 9 (or latest) installation.
Best of luck!

How to update Laravel Application (not the composer dependencies)

I have an question regarding updates to the framework of a Laravel application.
Normally I run the composer update command to update all of its dependencies. For the laravel framework the package laravel/framework is used.
But they made some changes in this package which require you to make changes in the core application (not in composer). The core application is the package laravel/laravel.
For example, in this commit they have made a function called confirmPassword() which refers to a file ConfirmPasswordController.php in the package laravel/laravel.
But this file didn't exists on my application because my application is not up-to-date.
My question
How do i keep my core application up to date?
Errors
See a typical example of updating the dependencies but not the application here.
First of all... This is not an easy question and IMO there are MANY possible scenarios... Depending on the code you developed, the packages you're using, the version you want to use, and so on...
Anyway This is what I would do in this situation:
Let's say for example I want to upgrade from version X to version Z where Z is two major / minor releases ahead of X
Step 1
Follow the next steps for one major / minor realease at time. Once I've tried to upgrade an application from Laravel 5.4 to 5.6 and it was completely broken. So I decided to upgrade to 5.5 and test the everything was working and, in case, block at that release. Luckily when I've upgraded from 5.5 to 5.6 (after code fix) I've managed to make everything work as it should.
Step 2
Upgrade the core framework and the plugins, check for errors during the upgrade and ofc, check the official documentation for any kind of compatibility problem
Step 3
Laravel has it's own upgrade guide that should be followed step by step. A good chunk of errors can be solved simply following that guide. There may be some plugins that doesn't provide it but usually the problems are releated to new features... It's hard that a method, class or trait has completely changed from one version to another.
Step 4
This step can be omitted, but from the example you've provided maybe it's better to add it. When there is a new feature that requires a specific class or trait or whatsoever, the simplest way to check if the error is thrown because of a file missing (and that is part of the "boilerplate") or has a different nature, is to create an empty project with that specific version and make a comparison with the "default" files.
For example, if you made no changes to the LoginController, checking if the new version has any kind of updates, may be the solution.
You can do this manually, following the upgrade guide for the version you're upgrading from/to, for example this one.
Alternatively, Laravel Shift is a paid but fairly inexpensive tool that will do it for you automatically. Since it's making changes to your project, you should carefully review everything it's done.

Laravel Update 4.1.24 to 4.2

im currently working on an update from laravel 4.1.24 to 5.6 The problem is i got nearly no experience with laravel. My question is now, how do i properly upgrade. Should i first upgrade to 4.2 and then to 5.0 and so on or would it be better to upgrade directly to 5.6 and how should i do this? I mean there are so many changes that i think i could miss something.
Also the project is just in a github repository, so it's hard to check if it's still working after an upgrade because i dont got the old modules. Or would it be enough to go on laravelshift. com and just upload it there to go from 4.1 to 4.2, 4.2 to 5.0 and so on.
Best regards!
The Laravel documentation contains a whole list of breaking changes that can help you to upgrade your application to a newer version. Laravel Shift is a service that checks and updates these changes in your project.
However, there is no way of being sure that your project will still work after these upgrades. Especially if you are using external modules its very risky.
If it is not required, I would not recommend upgrading from 4.1.x to 5.6 unless you have a lot of time on your hands. A solution could be to set up a completely new 5.6 project and add the project code file by file and test the implementations.
Start from here and follow instructions to upgrade it to 4.2. Then go through your packages and update their versions accordingly. When done use dropdown list in the top-right corner to select next version (5.0) and repeat it until you are at 5.6.
You definitely need to be able to run your code and test it somehow after each step because there will be problems. From 4.1 to 5.6 is a big leap and a lot of packages might have breaking changes etc. I only migrated as far as from 5.1 to 5.6 and it took me whole day to fix everything.
As for automated upgrade you can try it as well, but as I already mentioned you need to be able to test your work because all packages need to be updated as well.

Laravel QR code scanner

I'm interested in adding QR Scanner to my Laravel project, I found one that suits me it's called gruhn/vue-qrcode-reader there is also a written tutorial how to install it, but I just don't know where to add those codes or files. I've installed everything the problem is that I just don't know what to edit and how.
This is a late response: but for anyone who comes across this like me...
gruhn/vue-qrcode-reader was created using VueJS a Javascript Framework. Since you use Laravel: VueJS already comes preinstalled with Laravel depending on the version you use. You should also have Npm in order to use the npm run watch (the watcher).
Follow the installation steps found at their GitHub and then Simply create a new VueJS component and paste the code found in GitHub: gruhn/vue-qrcode-reader: while having a little understanding you can easily integrate this with Laravel by mounting the component where you wish to have the scanner in your project and viola it should work as advertised.
I hope this helps a bit.
You should try this one laravel package:-
https://github.com/werneckbh/laravel-qr-code
It would be best for you, because there are only few steps and that are too easy.

Upgrading to Laravel 5.4.0 from 5.1

I am using Laravel 5.1 and I would like to know how to upgrade to the latest version of Laravel which is 5.4.
Can we directly upgrade to Laravel 5.4 From 5.1 ?
The best way to upgrade is to follow the steps for each version. So upgrade to 5.2 then 5.3 then finally 5.4. The upgrade guides look lengthy but it most cases it wont take to much time because the guide covers all potential changes but they won't all apply to your application.
Alternatively you could install a fresh version of 5.4 then copy your application code into the new Laravel. Since the upgrade for each version is relatively straight forward and this method would lose your git history I wouldn't recommend it.
Another paid method would be to use Laravel Shift which will automate the upgrade process for you.
Edit: As #Scott mentioned you should make sure your server meets the server requirements for your target Laravel version. Specifically make sure you have PHP >= 5.6.4 installed
Well, you first you need to update your composer.json file. Around line 9, you should be requiring in the framework itself. Change that to use version 5.4.*. After that, run a composer update and then, yes, you do need to go through your files manually to address any incompatibilities.
after you replace provider folder to the new version.
https://github.com/laravel-shift/laravel-5.4/tree/master/app/Providers.

Resources