Back

Class 'Html' not found


Hello! I am starting a new project in Laravel via Laragon I create in views' folder layouts for my project in wich i have i a file named master.blade.php Then in the head of the current master.blade.php i include my assets by this line : {!!Html::style('css/bootstrap.min.css')!!} And i the routes folder i specified in the web.php this lline: Route::get('/dashboard', function () { return view('layouts.master'); });

when i started 'http://myproject.dev i can access to index wiews but not in "http://myprojetc.dev/dashboard " i get this error

Class 'Html' not found (View: C:\laragon\www\Laragon\resources\views\layouts\master.blade.php)

Someone can help me?

tajulasri replied 1 week ago

you are using package laravel/collective" ? if yes check your facades/alias class in app.php or another options is you can just using asset() helper method link

stayallive replied 1 week ago

Also make sure you have the alias as "Html" and not as "HTML" (which I believe is the default). If that is the case make sure you use "HTML" instead of "Html" in your views.

vitorfavila replied 1 week ago

Html is a facade/alias from laravel/collective package.

To install it, got to shell and type: (Laravel 5.4)

composer require "laravelcollective/html":"^5.4.0"

Then, add the provider to the providers array of config/app.php:

Collective\Html\HtmlServiceProvider::class,

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

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

More info here

Elsner Technologies replied 1 week ago

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,
]
 
BarthFox replied 4 days ago

Its not compatible with current version 5.4.27 now im a i am using the classic html. Thanks for your responses


Sign in to participate in this thread!


We'd like to thank these amazing companies for supporting us