Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 600
Daolin Avatar asked Sep 14 '15 19:09

Daolin


1 Answers

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,

like image 129
Chris Burton Avatar answered Nov 15 '22 00:11

Chris Burton