I recently upgraded my company's product (250k+ lines of code) from Laravel 5.7 to Laravel 9, this is how I did it: 1. Upgrade the dependencies that can be upgraded without upgrading Laravel, and replace abandoned dependencies. This took a while, for example the libraries we used to deal with PDF and generate charts completely changed their structure from one major version to another, so we had to rewrite a lot of stuff. 2. Upgrade to Laravel 5.8, bump dependencies to versions that support 5.8 3. Upgrade to Laravel 6, bump dependencies to versions that support 6 4. and so on and so on, until Laravel 9 For each step, we of course had to rewrite some functions because of dependencies' breaking changes
Do you know how many hours it took to upgrade? I'm looking at a project written in Laravel 4.2 and moving it to the latest version. Any insight would be helpful as we need to provide a budget for this work.
Thank you Povilas for all the suggestions. I have been working on a project with an older laravel version and want to upgrade it so in my opinion re-creating the project from scratch is the best option.
I'm working on a project that was using laravel 6... it was possible to bring it to 8.75, and I'll deliver as is because of the deadline but I realized that it's better to recreate the project! So throughout the journey, I put in a roadmap of all the functions, routes, and controllers... to make it a little bit easier to achieve a good result when I start to do that.
For older versions prior to version 7 or 6, I would perform a fresh installation of Laravel 10. Then, I would gather all the code from the previous projects and manually install all the necessary packages. Finally, I would ensure that everything is functioning properly by conducting thorough testing, as I would during a standard upgrade.
Bumping up the Laravel version in your projects gives you and your customer another big advantage. This way you can also step up the used PHP version, giving the application a free and noticable power and speed boost. I mostly use Laravel Shift to make version bumps. Bringing the production servers up to PHP 8 means adding a lot of free computing power to the applications.
Upgraded mine from 5.8.x to 10.x in around 1 hour, simply make an empty laravel project and then convert the routes, and move the models and some little stuff. It works!
Thank you SOOOOO much for this video and for Laravel Shift! OMG. You've made my week. Month. Maybe even year! I had three 5.7 projects that needed upgrading, and I managed to manually get them all up to Laravel v8 without toooooo much trouble. But that step from v8 to v9 was a big one and it gave me fits. Then I found this video and did a double-take on Laravel Shift. What is that? I asked. Went to the website and did a V-8 headslap. For a few bucks, Shift did my (first) upgrade from Laravel 8 to 9, leaving me with only a few minor clean-up tasks, and my app is working like a charm!! Guess who's Shifting the other two apps! :D I feel like a walking commercial for Laravel Shift. :P
Nice post! I planned to update my Laravel 7 app to Laravel 10. I was hoping it would be a straightforward affair of cloning my app from git repo (developed on local Mac at the time), to a laravel sail environment. But this is proving somewhat challenging, at least for the moment. Anyway, the strategy of starting from scratch, with L10 seems to make the most sense right now - I'll loop back on my journey with this.
I have used Rector PHP to upgrade code from PHP 7 to PHP 8 the noticible difference being the constructor property promotion. This make the code 'feel' modern. There are plugins for Laravel, which I haven't tried. I have used the PHP 8.0 rule (which includes ClassPropertyAssignToConstructorPromotionRector), which worked will with code that had either doc blocks or types already specified.
lets say you have a project from a client that was using laravel version 7 and you opted to recreate the whole project using laravel 10, do you charge the client for that?
In laravel 10 and docker implementation, I found monolog related issue that the Logger class is not found and the method signatur does not match and is not comparible. Though it is not the exact message but does anyone getting such error for monolog and collision package?
I have a very separate question. We use accessors in model to modify our results. But in some cases we don't want so.. E.g if we append a field xyz using accessors and we can get our desired result but in any other place or in any other function we don't want that xyz, what you think in that case we should do
Hi Povilas, thanks for the video. I use VS Code connected to GitHub and the repository connected to the live production server. Should I create a new branch to work on the updating process or how would you do it in a case like this? Thanks in advance for your help.
@@LaravelDaily Povilas thanks for your reply, perhaps is more a git question than a VS Code one. Your video sets the idea in my mind of upgrading my project. But I'm afraid of taking down the website for days and this site is my way of living. I have to learn more to be sure before trying the upgrade. Thanks again.
Hi povilas, I have a question I have a php extension file have abstract class and some class all in same file I wanna use it in laravel project i tried to include the file in my controller, alao tried to use namespace for the file and i couldn't Help me please how can i use this file
The best method is 1. install a empty laravel 10 project and copy composer.json file 2. make a backup of your old composer.json of old project 3. replace your existing composer.json with new laravel 10's composer.json 4. update your cmd/terminal php 8.1 5. finally its time to run : composer update 6. after that, fixed some error if arises 😎😎😎😎
Question. Exactly Laravel. How important is it to consider LTS versions? How many things are different between LTS and regular version? The latest LTS I see is version 6. It's already way too old.
In my opinion the best way is to create a new Laravel project and transfer all logic and install all packages then edit the legacy code , I upgraded Laravel project from 7 to 10. the worst thing is the packages but by searching everything will be fine
I recently updated a project from 5.5 to 9, almost a month to complete te update and many sleepless nights, i considered laravel shift but the prices were crazy, almost 200 dollars for the whole project
But sir with due respect pls its my request to upload a crud with search functionality, using react redux toolkit and laravel api pls, also im requesting for how to run any project with its dependencies, being in higher version of php and laravel.. Please sir
yeah true recently i was trying to upgrade an old project from v8 to v10 and found out that 2 of the packages were dead and for that reason couden't upgrade the project : (
Excuse me guys , How can I run a Laravel project from version 5 on my computer? Just run it in order to access the scripts that I will build in my project via Laravel 11.
If you have newer php version, you won't be able to run Laravel 5 project, unfortunately. But you can still read the files in the editor and copy their content, no?
It's not that easy. I have a project which uses webpack, datatables, fomantic-ui. The old webpack kind off compiles everything and that's not the case with vite. everything has to be exported and old vendor js libraries can't (or I can't)
Some people think that if you are in a project that is too old (like technical debt), you should get out of the project. By any chance, it’s kinda waste of time.
I recently upgraded my company's product (250k+ lines of code) from Laravel 5.7 to Laravel 9, this is how I did it:
1. Upgrade the dependencies that can be upgraded without upgrading Laravel, and replace abandoned dependencies. This took a while, for example the libraries we used to deal with PDF and generate charts completely changed their structure from one major version to another, so we had to rewrite a lot of stuff.
2. Upgrade to Laravel 5.8, bump dependencies to versions that support 5.8
3. Upgrade to Laravel 6, bump dependencies to versions that support 6
4. and so on and so on, until Laravel 9
For each step, we of course had to rewrite some functions because of dependencies' breaking changes
Do you know how many hours it took to upgrade? I'm looking at a project written in Laravel 4.2 and moving it to the latest version. Any insight would be helpful as we need to provide a budget for this work.
Thank you Povilas for all the suggestions. I have been working on a project with an older laravel version and want to upgrade it so in my opinion re-creating the project from scratch is the best option.
I'm working on a project that was using laravel 6... it was possible to bring it to 8.75, and I'll deliver as is because of the deadline but I realized that it's better to recreate the project! So throughout the journey, I put in a roadmap of all the functions, routes, and controllers... to make it a little bit easier to achieve a good result when I start to do that.
yeah going from laravel 6 to 10 is going to be a pain you should just copy paste all of your files to a new version at this point
For older versions prior to version 7 or 6, I would perform a fresh installation of Laravel 10. Then, I would gather all the code from the previous projects and manually install all the necessary packages. Finally, I would ensure that everything is functioning properly by conducting thorough testing, as I would during a standard upgrade.
I did this for every upgrade.
Install latest Laravel and migrate the old version code into the latest Laravel is the best approach.
Thanks Mr. Povilas Korop
Bumping up the Laravel version in your projects gives you and your customer another big advantage. This way you can also step up the used PHP version, giving the application a free and noticable power and speed boost. I mostly use Laravel Shift to make version bumps. Bringing the production servers up to PHP 8 means adding a lot of free computing power to the applications.
Upgraded mine from 5.8.x to 10.x in around 1 hour, simply make an empty laravel project and then convert the routes, and move the models and some little stuff. It works!
This is the best way. I always follow this
How many lines of code is this project?
@@OliverKurmis around 40K
Can you help me upgrade my project to the latest version?
Is there a video or tutorial for it, i had no idea about wht u say
Love your videos men. I get to learn new things every single day. God bless you
Thank you SOOOOO much for this video and for Laravel Shift! OMG. You've made my week. Month. Maybe even year! I had three 5.7 projects that needed upgrading, and I managed to manually get them all up to Laravel v8 without toooooo much trouble. But that step from v8 to v9 was a big one and it gave me fits. Then I found this video and did a double-take on Laravel Shift. What is that? I asked. Went to the website and did a V-8 headslap. For a few bucks, Shift did my (first) upgrade from Laravel 8 to 9, leaving me with only a few minor clean-up tasks, and my app is working like a charm!! Guess who's Shifting the other two apps! :D I feel like a walking commercial for Laravel Shift. :P
Nice post! I planned to update my Laravel 7 app to Laravel 10. I was hoping it would be a straightforward affair of cloning my app from git repo (developed on local Mac at the time), to a laravel sail environment. But this is proving somewhat challenging, at least for the moment. Anyway, the strategy of starting from scratch, with L10 seems to make the most sense right now - I'll loop back on my journey with this.
I have used Rector PHP to upgrade code from PHP 7 to PHP 8 the noticible difference being the constructor property promotion. This make the code 'feel' modern. There are plugins for Laravel, which I haven't tried. I have used the PHP 8.0 rule (which includes ClassPropertyAssignToConstructorPromotionRector), which worked will with code that had either doc blocks or types already specified.
Went from 5.4 to 10 in my company. Also migrated it from an IIS server to Nginx.
All in all the transition took several months. But I went through it.
Codecanyon projects have 'core' folder which 'app' folder and other folders are inside, how do they create those projects?
lets say you have a project from a client that was using laravel version 7 and you opted to recreate the whole project using laravel 10, do you charge the client for that?
Yes of course
In laravel 10 and docker implementation, I found monolog related issue that the Logger class is not found and the method signatur does not match and is not comparible. Though it is not the exact message but does anyone getting such error for monolog and collision package?
I have a very separate question.
We use accessors in model to modify our results.
But in some cases we don't want so..
E.g if we append a field xyz using accessors and we can get our desired result but in any other place or in any other function we don't want that xyz, what you think in that case we should do
Hard to say without exact code example. Maybe you named accessor the same as database field? You should name them differently
Hi Povilas, thanks for the video.
I use VS Code connected to GitHub and the repository connected to the live production server.
Should I create a new branch to work on the updating process or how would you do it in a case like this? Thanks in advance for your help.
I don't use vs code so I can't comment
@@LaravelDaily Povilas thanks for your reply, perhaps is more a git question than a VS Code one. Your video sets the idea in my mind of upgrading my project. But I'm afraid of taking down the website for days and this site is my way of living. I have to learn more to be sure before trying the upgrade. Thanks again.
Hi povilas,
I have a question
I have a php extension file have abstract class and some class all in same file
I wanna use it in laravel project
i tried to include the file in my controller, alao tried to use namespace for the file and i couldn't
Help me please how can i use this file
Can't answer in a comment, this situation needs debugging
The best method is
1. install a empty laravel 10 project and copy composer.json file
2. make a backup of your old composer.json of old project
3. replace your existing composer.json with new laravel 10's composer.json
4. update your cmd/terminal php 8.1
5. finally its time to run : composer update
6. after that, fixed some error if arises
😎😎😎😎
Question. Exactly Laravel. How important is it to consider LTS versions? How many things are different between LTS and regular version?
The latest LTS I see is version 6. It's already way too old.
In terms of Laravel, LTS is not important at all, it's best to use the latest version all the time, but all versions have 2 year support.
In my opinion the best way is to create a new Laravel project and transfer all logic and install all packages then edit the legacy code , I upgraded Laravel project from 7 to 10. the worst thing is the packages but by searching everything will be fine
What do you think about pinia ORM?
The methods naming of models & queries is oriented from laravel.
Haven't used it
Where i work on we are still using 5.5 😅
I recently updated a project from 5.5 to 9, almost a month to complete te update and many sleepless nights, i considered laravel shift but the prices were crazy, almost 200 dollars for the whole project
For a company, 200$ is must cheaper than a month of work
Hy , sir can u please add a vedio of how to update lower version of laravel and php with its dependencies
In this video, I specifically said why I'm not going to shoot that longer video
But sir with due respect pls its my request to upload a crud with search functionality, using react redux toolkit and laravel api pls, also im requesting for how to run any project with its dependencies, being in higher version of php and laravel..
Please sir
Sorry you're asking for too much
Hi, how are you? Any ideas where I can find laravel jobs online? mid level (5ys). Ty
I recently started this area on LaravelDaily laraveldaily.com/jobs/offers
@@LaravelDaily thank you!
Where're you from?
yeah true recently i was trying to upgrade an old project from v8 to v10 and found out that 2 of the packages were dead and for that reason couden't upgrade the project : (
Excuse me guys , How can I run a Laravel project from version 5 on my computer? Just run it in order to access the scripts that I will build in my project via Laravel 11.
If you have newer php version, you won't be able to run Laravel 5 project, unfortunately. But you can still read the files in the editor and copy their content, no?
what if I use another windows interface and downloaded an old version of php what is the old version that is compatible with laravel 5?
I don't remember by this point, please google Laravel 5 docs and see the installation requirements.
@@LaravelDaily thank you dear teacher.
It's not that easy. I have a project which uses webpack, datatables, fomantic-ui. The old webpack kind off compiles everything and that's not the case with vite. everything has to be exported and old vendor js libraries can't (or I can't)
Some people think that if you are in a project that is too old (like technical debt), you should get out of the project.
By any chance, it’s kinda waste of time.
Rule #1 - if it works - don't touch it
Until it doesn't work :)
until someone hacks you? lol
Super
sadly upgrading laravel is always such a hassle. doesnt seem like it wants to be upgraded
I'm coming from laravel 5.6
Pita 😭
rather, easy to do upgrade create draft laravel 10, and copy everything to new project and do the fixes rather easy...
and if neeed fork packages and bump them to support laravel 10 :)).