Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 Class 'HTML' not found

Anybody who are using laravel 5.* have to use laravelcollective/html because Package illuminate/html is abandoned, you should avoid using it.

your composer.json file should contain following code in require section(as i am using laravel 5.2 it will be mentioned as 5.2)

"laravelcollective/html": "5.2.*"

run composer update

and your config/app.php should contain following code in providers array

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

]

and aliases should contain

'aliases' => [

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

and please note that whatever aliase you mentioned should appear in your code as

{{HTML::linkAction('MemberController@show', 'view', array($value->id))}}

'HTML'=> 'Illuminate\Html\HtmlFacade'

should be

'Html'=> 'Illuminate\Html\HtmlFacade'


I think it's a case sensitive problem.

If you register it as 'HTML'=> 'Illuminate\Html\HtmlFacade' in app.php, you can't use it as html or Html ( then it will only work when you use HTML).


{!! Html::style( asset('public/css/artist.css')) !!}

... worked for me, but this

{{ HTML::style( asset('css/artist.css')) }}

... did not worked. But it should work. No!

Laravel is confusing me more from day to day. I try to learn this ... Notwell :D


  1. Add to composer.json:
    a) "illuminate/html": "5.*"
    b) Run Command:- composer update

  2. Add to the app.php providers array:
    a) 'Illuminate\Html\HtmlServiceProvider',

  3. Add to the app.php aliases array:
    a) 'Html' => 'Illuminate\Html\HtmlFacade',
    b) 'Form' => 'Illuminate\Html\FormFacade',

  4. Done


1 follow https://laravelcollective.com/docs/5.3/html

Begin by installing this package through Composer. Run the following from the terminal:

composer require "laravelcollective/html":"^5.3.0"
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,
    // ...
  ],

Now if you want

{{ HTML::style('css/bootstrap.min.css') }}

or

{!! HTML::style('css/bootstrap.min.css') !!}

//2 way follow.

    {{ HTML::style('css/bootstrap.min.css') }}

    //change to 

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

or

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

    //change to 

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

for more see this video tutorial..... https://www.youtube.com/watch?v=yl6hkoaCS6g


In the Laravel 5 "illuminate/html": "5.*" is deprecated and replaced with new dependency "laravelcollective/html": "~5.0"

Begin by installing this package through Composer. Edit your project's composer.json file to require "laravelcollective/html"

In your composer.json file update the following:

"require": {
   "laravelcollective/html": "~5.0"
}

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',
 // ...
],

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

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

You can also check it here for Laravel 5

https://laravelcollective.com/docs/5.0/html