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

跟風遠走 提交于 2019-12-09 11:13:39

问题


I updated composer.json to remove illuminate\html and add:

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

I removed the providers/aliases from app.php for Illuminate\Html and added the replacements:

    Collective\Html\HtmlServiceProvider::class,

...

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

However when running composer update I receive the output:

$ 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 

I tried updating composer.json scripts as suggested here: https://github.com/LaravelCollective/html/issues/54

But I'm still receiving the error. Any help is greatly appreciated :)


回答1:


In the end I managed to fix this with some help on IRC (thanks sisve) and these commands. First I rolled back to a working site with illuminate/html. Then:

composer dumpautoload
composer clearcache
php artisan clear-compiled

If the clear-compiled fails then make sure there are no references to Illuminate\Html in bootstrap/cache/config.php and run it again.

Remove all references to Illuminate\Html in config/app.php
Remove the illuminate/html require in composer.json

composer update

Add the laravelcollective/html package as described here: http://laravelcollective.com/docs/5.1/html#installation

composer update


来源:https://stackoverflow.com/questions/32283767/switching-from-illuminate-html-to-collective-html-class-illuminate-html-htmlse

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