3

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')!!}
Qazi
  • 5,015
  • 8
  • 42
  • 62

1 Answers1

6

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

Community
  • 1
  • 1
Qazi
  • 5,015
  • 8
  • 42
  • 62
  • 1
    What is different between the solution posted here and what you said you'd already done in your question? – patricus Mar 29 '16 at 05:17
  • there is miner difference while adding package in `composer.json` and running `composer require` command it added some different version – Qazi Mar 29 '16 at 05:36
  • I don't believe that would have had anything to do with your issue. I see you updated your question to correct the casing in your blade code. Was that a typo in your question, or were you using `HTML` in all caps? – patricus Mar 29 '16 at 05:38
  • OK, as I suspected, you added it to `composer.json` but you didn't actually *install* it via `composer update`. `composer require` basically does an update behind the scenes. – ceejayoz Mar 29 '16 at 18:21
  • @patricus I am still getting same error on windows plate farm (Windows 10) `Class Html not found` do you have an suggestion ? – Qazi Mar 30 '16 at 01:45
  • @patricus although when I made fresh Laravel installation and then install the `laravelcollective/html` that is working fine – Qazi Mar 30 '16 at 01:58