如何使用 PHP Composer 从 Laravel 中删除包? [英] How can I remove a package from Laravel using PHP Composer?

查看:79
本文介绍了如何使用 PHP Composer 从 Laravel 中删除包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 PHP Composer 从 Laravel 中删除包的正确方法是什么?

What is the correct way to remove a package from Laravel using PHP Composer?

到目前为止我已经尝试过:

So far I've tried:

  1. 从文件 composer.json 中删除声明(在require"部分)
  2. 从文件app.php中删除任何类别名
  3. 从我的代码中删除对包的任何引用:-)
  4. 运行composer update
  5. 运行composer dump-autoload
  1. Remove declaration from file composer.json (in the "require" section)
  2. Remove any class aliases from file app.php
  3. Remove any references to the package from my code :-)
  4. Run composer update
  5. Run composer dump-autoload

这些选项都不起作用!我错过了什么?

None of these options are working! What am I missing?

推荐答案

Composer 1.x 和 2.x

运行以下命令将从供应商(或安装包的任何地方)、composer.jsoncomposer.lock 中删除包.适当更改供应商/软件包.

Composer 1.x and 2.x

Running the following command will remove the package from vendor (or wherever you install packages), composer.json and composer.lock. Change vendor/package appropriately.

composer remove vendor/package

显然,您需要删除应用中对该包的引用.

Obviously you'll need to remove references to that package within your app.

我目前正在运行以下版本的 Composer:

I'm currently running the following version of Composer:

Composer version 1.0-dev (7b13507dd4d3b93578af7d83fbf8be0ca686f4b5) 2014-12-11 21:52:29

文档

https://getcomposer.org/doc/03-cli.md#remove

  • 26/10/2020 - 更新了 assert 命令的答案,适用于 Composer 的 v1.x 和 v2.x

这篇关于如何使用 PHP Composer 从 Laravel 中删除包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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