如何更新Laravel Application(不是Composer依赖项) [英] How to update Laravel Application (not the composer dependencies)

查看:81
本文介绍了如何更新Laravel Application(不是Composer依赖项)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于Laravel应用程序框架更新的问题.

通常,我运行composer update命令来更新其所有依赖项.对于laravel框架,使用了 laravel/framework 包.

但是他们在此程序包中进行了一些更改,这些更改要求您在核心应用程序(而不是composer)中进行更改.核心应用程序是软件包 laravel/laravel .

例如,在对此提交一个名为confirmPassword()的函数,该函数引用包laravel/laravel中的文件ConfirmPasswordController.php. 但是此文件在我的应用程序上不存在,因为我的应用程序不是最新的.

我的问题
我如何使我的核心应用程序保持最新状态?

错误
请参阅更新依赖关系而不是应用程序的典型示例解决方案

首先...这不是一个简单的问题,IMO有许多可能的情况...取决于代码您开发的,正在使用的软件包,您要使用的版本,等等...

无论如何,在这种情况下,我会这样做:

例如,假设我要从X版本升级到Z版本,其中Z是X之前的两个主要版本/次要版本

步骤1

请按照以下步骤进行一次主要/次要重新分配.一旦我尝试将应用程序从Laravel 5.4升级到5.6,它就完全坏了.因此,我决定升级到5.5并测试一切正常,以防万一阻止该版本的发布.幸运的是,当我从5.5升级到5.6(在代码修复后)时,我设法使一切正常进行.

步骤2

升级核心框架和插件,检查升级和ofc期间的错误,检查官方文档中是否存在任何兼容性问题

步骤3

Laravel有自己的升级指南,应逐步进行.只要遵循该指南,就可以解决很多错误.可能有一些插件不提供它,但是通常问题都与新功能有关...方法,类或特性很难完全从一个版本更改为另一个版本.

步骤4

可以省略此步骤,但是从您提供的示例中也许最好添加它.当有一个新功能需要特定的类或特征或其他任何功能时,检查是否由于文件丢失(属于样板"的一部分)或性质不同而引发错误的最简单方法是:创建具有该特定版本的空项目,然后与默认"文件进行比较.

例如,如果您未对LoginController进行任何更改,则可以解决该新版本是否具有任何更新的问题.

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.

这篇关于如何更新Laravel Application(不是Composer依赖项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆