Search code examples
laravellaravel-5illuminate-containerlaravelcollective

Laravel 5.2, LaravelCollective 5.2, Class 'Html' not found


I followed these steps but still getting "Html" class not found.

added in composer.json

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

once installed, added these lines in config/app.php

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

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

please see attached screen shot. what can be the reason, I also tried composer dump-autoload composer clear-cache but it didn't resolve the issue

enter image description here

Updated

View sample code

{!!Html::style('assets/css/bootstrap.min.css')!!}
{!!Html::style('assets/css/custom.css')!!}

{!!Html::script('assets/js/jquery.min.js')!!}
{!!Html::script('assets/js/bootstrap.min.js')!!}

Solution

  • I just found the solution here, its worked perfectly.

    Followed these steps

    composer require laravelcollective/html
    

    it will install html & form as per your installed Laravel version (mine 5.2)

    Added Providers and Aliases

    Open config/app.php In providers array add

    Collective\Html\HtmlServiceProvider::class
    

    and in aliases array add

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

    Found solution here


    http://laraveldeveloper.me/form-in-laravel-5-2/

    Stackoverflow

    https://stackoverflow.com/a/35169836/1216451

    https://stackoverflow.com/a/34807375/1216451