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

Published 1 week ago by BarthFox

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?

Best Answer (As Selected By BarthFox)
rubol

Try older version of laravel collective instead.

rubol
rubol
1 week ago (7,130 XP)

First check your composer.json file whether you have installed laravelcollective/html package or not.

Check you config/app.php: file for

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

and

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

Try also running composer update

rubol
rubol
1 week ago (7,130 XP)

If you haven't installed installed laravelcollective run

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

in terminal.

BarthFox

When i run composer update it return this error: Nothing to install or update Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.

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

I am using laravel 5.4.25

BarthFox

and when i refresh http://myproject.dev it shows me : (1/1) FatalThrowableError

Class 'Collective\Html\HtmlServiceProvider' not found

Snapey
Snapey
1 week ago (523,835 XP)

You would be better served not using it.

The html shortcuts are so trivial it's easier to just write out the html

rubol
rubol
1 week ago (7,130 XP)

Try older version of laravel collective instead.

Snapey
Snapey
1 week ago (523,835 XP)

You are installing a package so that this

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

gets converted to this;

<link href="/css/bootstrap.min.css" rel="stylesheet">

If you are just starting out in web development you should get to know this stuff

BarthFox

Thanks @Snapey for your suggestion. (y)

Accept anothers response.

BarthFox

Your right @Snapey it's like a shortcut of this link ...no problem thanks but if i can get a solution it's better too

BarthFox

How do i Try older version of laravel @rubol

rubol
rubol
1 week ago (7,130 XP)

For v.5.3

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

For v.5.2

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

For v.5.1 add require parameter of composer.json file

"laravelcollective/html": "5.1.*"

For v.5.0 add require parameter of composer.json file

"laravelcollective/html": "~5.0"

Sign In or create a forum account to participate in this discussion.