简体   繁体   English

Laravel用作曲家删除包

[英]Laravel deleting package with composer

I tried to delete barryvdh/laravel-debugbar from my laravel installation, and it seems I didn't make something right. 我尝试从我的laravel安装中删除barryvdh / laravel-debugbar ,似乎我没有做出正确的事情。

What I did so far : 到目前为止我做了什么:

  • composer remove barryvdh/laravel-debugbar
  • I deleted then the references in config/app.php 我删除了config / app.php中的引用

And I've got an error : 我有一个错误:

[RuntimeException]
Error Output: PHP Fatal error:
Class 'Barryvdh\Debugbar\ServiceProvider' not found in 
{mypath}\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 146

I tried dump-autoload, clear-compiled, but none works. 我尝试了dump-autoload,清除编译,但没有一个工作。

What did I miss ? 我错过了什么 ?


22/02/2016 Edit : I also tried to remove ALL the vendor folder, then install it again via composer install , but I got the error again when the command php artisan clear-compiled was run angain. 22/02/2016编辑:我也尝试删除所有vendor文件夹,然后通过composer install再次安装它,但是当命令php artisan clear-compiled运行时,我再次收到错误。

Ok, it seems I had played with artisan commands, and the configuration file was cached ( via php artisan config:cache ). 好吧,似乎我玩过工匠命令,配置文件被缓存( 通过 php artisan config:cache )。

I deleted it (in bootstrap/cache/config.php ) and everything works like a charm, but I also could have used the command php artisan config:clear to remove it. 我删除它(在bootstrap/cache/config.php ),一切都像魅力,但我也可以使用命令php artisan config:clear删除它。

When you installed Debugbar, after the package was install via composer you needed to add the class to the providers array in config/app.php . 当您安装Debugbar时,在通过composer安装软件包之后,您需要将该类添加到config/app.phpproviders数组中。 So you need to remove this line from there: 所以你需要从那里删除这一行:

Barryvdh\Debugbar\ServiceProvider::class

If you also register the facade, then you need to remove the following from the aliases array from the same file: 如果还注册了外观,则需要从同一文件中删除aliases数组中的以下内容:

'Debugbar' => Barryvdh\Debugbar\Facade::class

If you also ran php artisan vendor:publish (which is the final step described in the Installation Section from the package readme) then you can delete the config/debugbar.php file as well, although leaving that configuration file in place will not cause any issues. 如果您还运行了php artisan vendor:publish (这是封装自述文件中安装部分中描述的最后一步),那么您也可以删除config/debugbar.php文件,尽管保留该配置文件不会导致任何的问题。

Marc Brillault's answer is correct. Marc Brillault的回答是正确的。 I am adding more clarification to that answer: 我正在为这个答案添加更多说明:

I removed debug bar class manually from the catch files. 我从catch文件中手动删除了调试栏类。 present in ( bootstrap/cache/config.php ). 存在于( bootstrap/cache/config.php )中。

Steps for How to remove manually class. 如何删除手动类的步骤。

1.) Open this two files 
   `bootstrap/cache/config.php`
   `config/app.php`

2.) Find this two line and remove It.        
    Barryvdh\Debugbar\ServiceProvider::class,
   'Debugbar' => Barryvdh\Debugbar\Facade::class,

3.) run command `php artisan config:clear`

after the following this step check command php artisan list is working well. 经过以下这一步检查命令php artisan list运行良好。

you must: 你必须:

First. 第一。 Delete the references to Debugbar in config/app.php 删除config / app.php中对Debugbar的引用

Second. 第二。 composer remove barryvdh/laravel-debugbar 作曲家删除barryvdh / laravel-debugbar

In that order. 以该顺序。 If you don't, Laravel get confused ;) 如果你不这样做,Laravel会感到困惑;)

您需要做的最好的方法是在所有编辑器文件中手动删除所有文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM