Laravel Update 4.1.24 to 4.2 - laravel

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.

Related

Upgrading a laravel 5.4 project to laravel 7

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!

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.

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.

Upgrade from Laravel 4.1 to directly Laravel 5.3

I have an app which was developed 3-4 years back in Laravel 4.1 and as per the current need I've been asked to port the web application written in Laravel 4.1 to current stable and recent version of Laravel 5.3 directly (without stepwise upgrade to 4.2/5.0/5.1 or 5.2). Is it better to port which may take a lot of time due to architectural change difference or rewrite everything from scratch in the latest Laravel 5.3 version?
Thank you,
Rohit
Depending on the size of your application, it may be easier to just create a new 5.3 application and copy over your files and making the necessary modifications as you go.
There would be no way to just directly upgrade from 4.1 to 5.3 - you'd have to do all the steps in between in some manner.

Upgrade laravel 3 to 5

I want to upgrade laravel version from 3.1 to 5.x. What steps I need to follow to do this?
Approach I found based on research is
Moving 3 to 4 first and then from 4 to 5.
Fresh installation of laravel 5 and change my code accordingly.
There is no easy way to upgrade Laravel 3 to any other Laravels. There are quite a bit bottle-necks there
1. Laravel 3 is based on Symphony2 and mostly influenced from Sphinx, on the other hand laravel4-5 is based on Symphony3.
2. Core Laravel3 is build on base level, so everything you build in your application folder builds up on top of Laravel instance, but Laravel4 and 5 are a composer package. So basically you are using these packages along with others to build your system.
3. Laravel3 has bundles and Laravel 4-5 has packages. Bundles has been deprecated quite long time ago and most of them are not being maintained anymore. Building process and structure is totally different than packages work.
and this list goes on and on.
Like I mentioned at the beginning there is easy way for it. By easy I meant running a script and everything is brand new.
From views to application, to schemas and Eloquent, many coding style and structure is changed in Laravel4. So long story short, there is no upgrade documentation for 3 to others because the only way to upgrade is rebuilding the application with new way. Even if you find a script to automate most of your code conversions, you still need to go through bundles and find right packages, add them to your composer and find old usages of them in your code to replace with new way.
The laravel docs give pretty good guides on how to upgrade (you first have to upgrade to 4, then to 5).
But since Laravel 5 is so different in every way, I wouldn't be surprised it's actually faster just to rewrite everything. At the very least it's safer and more optimized!

Resources