Search code examples
phplaravellaravelcollective

Can't install Laravelcollective/HTML in Laravel 5.1


I have problem when install Laravelcollective/HTML in Laravel 5.1 Install laravelcollective/html document. First, I install through Composer:

composer require illuminate/html

Message: Using version ~5.0 for illuminate/html ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)

But it's version 5.0 so remove it.

composer remove illuminate/html

And install version 5.1

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

Next, update Composer from the Terminal:

composer update

Next, add your new provider to the providers array of config/app.php:

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

Finally, add two class aliases to the aliases array of config/app.php:

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

And message error:

 FatalErrorException in ProviderRepository.php line 146:
 Class 'Collective\Html\HtmlServiceProvider' not found

Solution

  • Before I ran composer update, I had somehow added to config/app.php the below and thus it generated the same error you were getting.

    Don't add the below until after doing the composer update.

    'providers' => [
        // ...
        Collective\Html\HtmlServiceProvider::class,
        // ...
      ],
    
      'aliases' => [
        // ...
          'Form' => Collective\Html\FormFacade::class,
          'Html' => Collective\Html\HtmlFacade::class,
        // ...
      ],