未找到 Laravel 5 类“Illuminate\Html\HtmlServiceProvider”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28541051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Class 'Illuminate\Html\HtmlServiceProvider' not found Laravel 5
提问by kazehaya
I'm trying to add the HtmlServiceProvider with Laravel 5.
我正在尝试使用 Laravel 5 添加 HtmlServiceProvider。
I keep getting the following error:
我不断收到以下错误:
FatalErrorException in compiled.php line 6391: Class 'Illuminate\Html\HtmlServiceProvider' not found
编译的.php 行 6391 中的 FatalErrorException: Class 'Illuminate\Html\HtmlServiceProvider' not found
This is how my providers look like:
这是我的提供者的样子:
'providers' => [
/*
* Laravel Framework Service Providers...
*/
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Bus\BusServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Foundation\Providers\FoundationServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Pipeline\PipelineServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
/*
* Application Service Providers...
*/
'App\Providers\AppServiceProvider',
'App\Providers\BusServiceProvider',
'App\Providers\ConfigServiceProvider',
'App\Providers\EventServiceProvider',
'App\Providers\RouteServiceProvider',
],
This is how my aliases look ik app.php:
这就是我的别名在 ik app.php 中的样子:
'aliases' => [
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Bus' => 'Illuminate\Support\Facades\Bus',
'Cache' => 'Illuminate\Support\Facades\Cache',
'Config' => 'Illuminate\Support\Facades\Config',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Hash' => 'Illuminate\Support\Facades\Hash',
'Input' => 'Illuminate\Support\Facades\Input',
'Inspiring' => 'Illuminate\Foundation\Inspiring',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
],
At last i have added this inside my composer.json
最后我在我的 composer.json 中添加了这个
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "~5.0"
},
Somehow i keep getting this error so im hoping someone can help me out with this :)
不知何故,我一直收到这个错误,所以我希望有人能帮我解决这个问题:)
Thanks in advance!
提前致谢!
回答by Arlind
First add this line to composer.json
首先将此行添加到composer.json
"illuminate/html": "~5.0"
Then do a composer update
Wait for the update to finish, then open config/app.phpadd this:
然后做一个composer update
等待更新完成,然后打开config/app.php添加这个:
'Illuminate\Html\HtmlServiceProvider',
to the providers
array and this:
到providers
数组和这个:
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
to the aliases
array, and be sure when you use Html in blade or wherever use it in lowercase 'Html' not HTML
到aliases
数组,并确保在刀片中使用 Html 或在任何地方使用小写的“Html”而不是 HTML
Here is a reference link: http://thegeekyland.blogspot.com/2015/11/class-illuminatehtmlhtmlserviceprovider.html
这是一个参考链接:http: //thegeekyland.blogspot.com/2015/11/class-illuminatehtmlhtmlserviceprovider.html
回答by arslion
Illuminate\Html\HtmlServiceProvider is not a core element anymore. Laravel components that have been removed from the core framework are available on laravelcollective.com your html & forms components can be found here:
Illuminate\Html\HtmlServiceProvider 不再是核心元素。已从核心框架中删除的 Laravel 组件可在 laravelcollective.com 上找到,您可以在此处找到 html 和表单组件:
http://laravelcollective.com/docs/5.0/html
http://laravelcollective.com/docs/5.0/html
add this to your composer.json :
将此添加到您的 composer.json :
"laravelcollective/html": "~5.0"
then update composer:
然后更新作曲家:
composer update
then add providers in config/app.php
然后在 config/app.php 中添加提供者
'Collective\Html\HtmlServiceProvider',
and finally add two aliases in the same file:
最后在同一个文件中添加两个别名:
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
回答by Kyizin
Illuminate/HTML package has been deprecated
Illuminate/HTML 包已被弃用
Use:laravelcollective/html
使用:laravelcollective/html
https://stackoverflow.com/a/34991188/3327198
https://stackoverflow.com/a/34991188/3327198
composer require laravelcollective/html
Add this lines in config/app.php
在 config/app.php 中添加这一行
in providers group:
在提供者组中:
Collective\Html\HtmlServiceProvider::class,
in aliases group:
在别名组中:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
回答by Tijo John
Try the following steps Edit your project's composer.json file.
尝试以下步骤 编辑项目的 composer.json 文件。
"require": {
"laravelcollective/html": "~5.0"
}
}
Next, update Composer from the Terminal:
接下来,从终端更新 Composer:
composer update
作曲家更新
Next, add your new provider to the providers array of config/app.php:
接下来,将您的新提供程序添加到 config/app.php 的 providers 数组中:
'providers' => [ // ... 'Collective\Html\HtmlServiceProvider', // ... ],
'providers' => [ // ... 'Collective\Html\HtmlServiceProvider', // ... ],
Finally, add two class aliases to the aliases array of config/app.php:
最后,在 config/app.php 的 aliases 数组中添加两个类别名:
'aliases' => [
// ...
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
// ...
],
],
回答by gildniy
Me I found another cause for this issue:
我发现这个问题的另一个原因:
in ../Vendor directory sometimes there is a file called "config.php", either delete that file completely or find in there some thing like this line:
在 ../Vendor 目录中,有时会有一个名为“config.php”的文件,要么完全删除该文件,要么在其中找到类似这一行的内容:
array (
...
28 => 'Illuminate\Html\HtmlServiceProvider',
...
),
, and remove the line, and then do the "composer update" command, this will help. (It helped me too).
,并删除该行,然后执行“composer update”命令,这会有所帮助。(它也帮助了我)。
回答by Md Sirajus Salayhin
You can also use like thisIlluminate\Html\HtmlServiceProvider::class,
and
您也可以使用像这样Illuminate\Html\HtmlServiceProvider::class,
和
'Form' => Illuminate\Html\FormFacade::class,
'Html' => Illuminate\Html\HtmlFacade::class,
回答by kantsverma
You can follow below link of Laravel documentation there you can find the solution for all version or Laravel i.e 5.0, 5.1, 5.2, 5.3
您可以按照 Laravel 文档的以下链接,在那里您可以找到所有版本或 Laravel 的解决方案,即 5.0、5.1、5.2、5.3
回答by Jeremy Schaffer
The error indicates it can't find the service provider so make sure you do a composer update. If you did do a composer update check your vendor folder to make sure it pulled in the dependency.
该错误表明它找不到服务提供者,因此请确保您进行 Composer 更新。如果您确实进行了 Composer 更新,请检查您的供应商文件夹以确保它包含在依赖项中。
回答by Awais Tahir
Double check when Updating your composer, whether you're in the right directory
更新作曲家时仔细检查,是否在正确的目录中
回答by santoshvijaypawar
Run this in cmd
在 cmd 中运行这个
php artisan Illuminate\Html
and then add variables in app.php
然后在 app.php 中添加变量