BladeOfGaladrial's avatar

Upgrading form Laravel 8.x to Laravel 11.x

Hi, I am fairly new to Laravel, the project I am currently working with requires me to upgrade from Laravel 8.x to Laravel 11.x while fixing and developing things. I have 2 question on how to do this

  1. How am I to upgrade framework's version.
  2. How should I approach developing/fixing on the existing code.

Since I am working alone here I could use some guidance. Below is my composer.json

0 likes
9 replies
JussiMannisto's avatar

Upgrade the app one major version at a time. Laravel.com has good upgrade guides. Start by upgrading to Laravel 9, and read all of the notes.

The app structure changed quite a bit in L11. The kernel and exception handler files are gone, and their functionality is implemented through method calls in the bootstrap/app.php file. Luckily, L11 is backwards compatible with the old structure and you can just upgrade it normally. Laravel.com also doesn't recommend migrating the application structure when moving from L10 to L11.

TLDR: Follow the upgrade guide.

3 likes
Tray2's avatar

If you have the funding, you can always give this a go.

https://laravelshift.com/

It does the upgrade for you, and you can concentrate on the new features instead.

If you don't have the funds, the follow the upgrade guides as @jussimannisto says.

1 like
JussiMannisto's avatar

@Tray2 I've never used Laravel Shift, and I'm curious how it works in non-trivial cases. For example, I remember having to do some rewrites during the switch from SwiftMailer to Symfony Mailer because we were using some underlying features of SwiftMailer. Do you know how Shift works in these situations; does it give you warnings etc.?

Tray2's avatar

@JussiMannisto No idea, I just know that it exists and that it's quite popular. I think there are some videos showing how it works.

BladeOfGaladrial's avatar

I am also inclined to follow the guide since that was the first thing I looked up. My main concern is that I am not very familiar with application as I have only been working on it for a couple of days. I am also very much aware of directory structure changed from 8.x to 11.x, so just hesitant moving/deleting etc etc files. Thanks for the direction, I will keep updating here either if I am stuck or I get the upgrade to work successfully

BladeOfGaladrial's avatar

@snapey @jussimannisto @tray2 Just thinking on top of my head, would It be a good idea to just start a new v11 project and start carefully reusing the existing code. Reason being that we are looking to incorporate CI/CD with github and all the media (images) are right now living in the public folder which honestly I do not want to push to the git. Those images will live seperately in cdn servers Besides there are a lot of refactoring of old code involved here.

Also I am to develop new features on existing application and upgrade it at the same time also make sure everything else works (I am alone doing this)

martinbean's avatar

would It be a good idea to just start a new v11 project and start carefully reusing the existing code.

@bladeofgaladrial Are you going to do that every time a new Laravel framework version is released?

Reason being that we are looking to incorporate CI/CD with github and all the media (images) are right now living in the public folder which honestly I do not want to push to the git.

You don’t have to push them. Just add a rule in your project’s .gitignore file to ignore the contents of directories containing user-uploaded files.

Besides there are a lot of refactoring of old code involved here. Also I am to develop new features on existing application and upgrade it at the same time also make sure everything else works (I am alone doing this)

If you start a new project, then you’re just increasing your work—especially if you’re working on your own—as now you’ll have two applications to maintain: the “legacy” application, and the new one you’re trying to move code to, whilst also handling bug fixes across both applications, whilst also trying to develop new features in the new application.

Please or to participate in this conversation.