Daolin
Daolin

Reputation: 634

'Illuminate\Html\HtmlServiceProvider' not found when trying to install 'Illuminate\Html' in laravel 5

I understand that there are several similar questions here but none of them fixed my problem.

I'm trying to add the HtmlServiceProvider with Laravel 5 on Ubuntu 14.04. I keep getting the following error:

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          

My vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository
.php looks like:

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

My /.../config/app.php looks like:

'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,


],

In my compose.Jason

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

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

Any help would be really appreciated. Sorry again if this question seems duplicated to you.


composer update works if I remove provider and aliases I added. But after I add them back in, same error appears.

Upvotes: 5

Views: 4372

Answers (2)

patriziotomato
patriziotomato

Reputation: 639

Step 1 composer.json

"illuminate/html": "~5.0"

Step 2 process dump-autoload

composer.phar dump-autoload

Step 3 app.php

Illuminate\Html\HtmlServiceProvider::class,

and

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

Step 4 flush caching (if needed)

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

Upvotes: 0

Chris Burton
Chris Burton

Reputation: 1205

Step 1

In composer.json under require, add:

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

Step 2

run composer update in your terminal

Step 3

Add the following in config/app.php under providers:

Collective\Html\HtmlServiceProvider::class,

Step 4

Add the following in config/app.php under aliases:

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

Upvotes: 7

Related Questions