How to update Laravel Application (not the composer dependencies)

▼魔方 西西 提交于 2019-12-23 17:17:19

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/58374153/how-to-update-laravel-application-not-the-composer-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!