Laravel

Class ‘HTML’ not found Laravel 5

Class ‘HTML’ not found Laravel 5 :

I have started to check what is new in laravel. I have get shocked the entire laravel structure’s are changed. We can simple say It is a rebuild version of laravel 4. I have to tried to work with form in Laravel 5 but I got Class ‘HTML’ not found Error.

Why?

The reason in Laravel 5 does’t have default  HTML of Form. Now form builder is new package for laravel 5. You need to install “illuminate/html” to access html and classes inside laravel 5.

How to install laravel 5.

1. Install Composer [ Check http://www.17educations.com/php/how-to-install-laravel-on-windows/]

2. Run composer create-project laravel/laravel laravel-5 –prefer-dist  // laravel-5 is your folder name.

You will get below message.

laravel-5

3. Run http://localhost/laravel-5/public/ in browser you can see laravel installed.

If you try to access HTML and Classes in View you will get ” Something went wrong Class ‘HTML’ not found Error “.

How to Fix?

1. Add ” illuminate/html ” in composer.json file require section.

// Example.

2. Run Composer update.

3. You will get below screen.

laravel-html

4. Once you installed add ” Illuminate\Html\HtmlServiceProvider ”  in Laravel Service provider and alias.

//Example

Thats all you can now access HTML and class like Laravel 4 Like below.

 

Why {!! !!} instead of {{  }} ?

In laravel 4 we have using {{ }} for raw format. Now its depricated in laravel 5. So we need to access raw content inside {!! !!}

What’s is RAW?

{!! !!} is short code for <?php echo ”; ?>

Thanks!. If you like this article don’t forget to share and comment.