尝试在laravel 5中安装'Illuminate \ Html'时找不到'Illuminate \ Html \ HtmlServiceProvider'

时间:2015-09-14 19:59:01

标签: php laravel laravel-5 illuminate-container

我知道这里有几个类似的问题,但没有一个能解决我的问题。

我正在尝试在Ubuntu 14.04上添加带有Laravel 5的HtmlServiceProvider。我一直收到以下错误:

dl@dl-VirtualBox:~/l5todo$ composer update
> php artisan clear-compiled
PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found in /home/dl/l5todo/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146



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



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



  [RuntimeException]                                                                       
  Error Output: PHP Fatal error:  Class 'Illuminate\Html\HtmlServiceProvider' not found i  
  n /home/dl/l5todo/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository  
  .php on line 146          

我的vendor / laravel / framework / src / Illuminate / Foundation / ProviderRepository
      .php看起来像:

   /**
 * Create a new provider instance.
 *
 * @param  string  $provider
 * @return \Illuminate\Support\ServiceProvider
 */
public function createProvider($provider)
{
    return new $provider($this->app);//line 146
}

我的/.../config/app.php看起来像:

'providers' => [

    Illuminate\Html\HtmlServiceProvider::class, //newly added

   ......
],
'aliases' => [

    'App'       => Illuminate\Support\Facades\App::class,
    'Artisan'   => Illuminate\Support\Facades\Artisan::class,
    'Auth'      => Illuminate\Support\Facades\Auth::class,
    'Blade'     => Illuminate\Support\Facades\Blade::class,
    'Bus'       => Illuminate\Support\Facades\Bus::class,
    'Cache'     => Illuminate\Support\Facades\Cache::class,
    ......
  'Form' => Illuminate\Html\FormFacade::class,
    'Html' => Illuminate\Html\HtmlFacade::class,


],

在我的作曲中。杰森

"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",

    "Illuminate/Html": "~5.0"
},

任何帮助都会非常感激。 如果这个问题似乎与您重复,请再次抱歉。

如果删除我添加的提供程序和别名,

composer update有效。但是在我重新添加之后,会出现同样的错误。

2 个答案:

答案 0 :(得分:6)

第1步

在require下的composer.json中,添加:

"laravelcollective/html": "5.1.*",

第2步

在您的终端中运行composer update

第3步

在提供商下的config / app.php中添加以下内容:

Collective\Html\HtmlServiceProvider::class,

第4步

在别名中的config / app.php中添加以下内容:

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

答案 1 :(得分:0)

第1步 composer.json

"illuminate/html": "~5.0"

第2步 process dump-autoload

composer.phar dump-autoload

第3步 app.php

Illuminate\Html\HtmlServiceProvider::class,

'Form'  => Illuminate\Html\FormFacade::class,

第4步刷新缓存(如果需要)

composer.phar dump-autoload
php artisan config:clear
php artisan clear-compiled