从 Illuminate\Html 切换到 Collective\Html,Class 'Illuminate\Html\HtmlServiceProvider' 未找到

Switching from Illuminate\Html to Collective\Html, Class 'Illuminate\Html\HtmlServiceProvider' not found

我更新了 composer.json 以删除 illuminate\html 并添加:

"require": {
    "laravelcollective/html": "5.1.*"

我从 app.php 中删除了 Illuminate\Html 的 providers/aliases 并添加了替换:

    Collective\Html\HtmlServiceProvider::class,

...

    'Form'      => Collective\Html\FormFacade::class,
    'Html'      => Collective\Html\HtmlFacade::class,

但是当 运行 composer update 我收到输出:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing illuminate/html (v5.0.0)

- Installing laravelcollective/html (v5.1.4)
  Downloading: 100%  

Writing lock file
Generating autoload files
> php artisan clear-compiled
PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648

[Symfony\Component\Debug\Exception\FatalErrorException]  
Class 'Illuminate\Html\HtmlServiceProvider' not found                                                     

Script php artisan clear-compiled handling the post-update-cmd event returned with an error

[RuntimeException]                                                                   
Error Output: PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 648 

我尝试按照此处的建议更新 composer.json 脚本:https://github.com/LaravelCollective/html/issues/54

但我仍然收到错误消息。 非常感谢任何帮助:)

最后,我在 IRC(感谢 sisve)和这些命令的帮助下设法解决了这个问题。首先,我使用 illuminate/html 回滚到工作站点。那么:

composer dumpautoload
composer clearcache
php artisan clear-compiled

如果 clear-compiled 失败,请确保 bootstrap/cache/config.php 和 运行 中没有对 Illuminate\Html 的引用。

删除 config/app.php
中对 Illuminate\Html 的所有引用 在 composer.json

中删除 illuminate/html 要求
composer update

按照此处所述添加 laravelcollective/html 包:http://laravelcollective.com/docs/5.1/html#installation

composer update