Upgrade laravel 3 to 5 - laravel

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!

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.

Should I Shift from Laravel 4 to Laravel 5 for My New Project

I've use L4 in my old project, for about 1.5 years. Now I'm facing new project, should I shift to L5 ? How long it will be to learn L5, are there any major change happen from L4 to L5 that make it difficult to shift ?
Now or in the future you are likely to migrate from Laravel 4 to Laravel 5. Why not give it a shot right now? Laravel has good migration documentation. Areas where care needs to be taken are marked in red notes.
Laravel also has upgrade path documentation from 4.2. I would highly recommend setting up a virtual machine (VM) with your environment, taking a snapshot of the VM, and performing the upgrade in the VM until you get comfortable. Note down steps on a piece of paper. Revert the snapshot to bring the VM back to the state it was before the upgrade and follow the steps you had written down. Once successful, perform the migration on the main system (and take backups before you begin).
Check out Laravel 5's release notes here to get a better understanding of the changes: http://laravel.com/docs/5.0/releases#laravel-5.0.
The level of difficulty is medium (not too hard, not too easy), I feel.

CodeIgniter version 2.0 is stable enough to use?

i want to port my application to CodeIgniter but i am wondering whether i should use their v2.0 or v1.72 (then when they release 2.0, upgrade it).
i have never used a framework before so i don't exactly know what implies when upgrading a framework: what does it mean practically - i just move the folders and it will work? or do i have to change a lot of settings, file structure etc? could someone enlighten me about the upgrade process.
and what would you use: v.1.72 or v2.0?
if i'm using the latest version, is there a good documentation for it somewhere so you can read about how to use the new features: packages, drivers and so on.
thanks
You can read about some of the changes in 2.0 here.
I would image the upgrade process should be straightforward as long as you do not use any features that are different/removed such as plugins. Just take your models, controllers, etc and drop them into the 2.0 framework. Then regression test you whole app, fixing any problems as you see them...
If you are selling this app or making something mission critical then of course v1.7.2 is the best choice. That said I have PyroCMS running on v2.0 and since some of my bug-fixes were merged it seems stable enough.
One should consider time frames for deployment:
If it is one week, then stick to v1.7.2
If it is three months, go with v2
Assuming three months is approximately to time for a release to stabilise?

Resources