How to Install Illuminate/HTML In Laravel 5

In Laravel 4 the Illuminate package is included by default. In Laravel 5 If want to use Form or HTML helpers, you have to install Illuminate/HTML otherwise you will see an error stating class 'Form' not found or class 'Html' not found. So here’s is the instruction on how to install Illuminate/HTML in Laravel 5.

First of all add "illuminate/html": "5.0.*@dev" to your composer.json file in the require section and run composer update.
Next up to add aliases and HTML facades and service provider, update your /config/app.php as follows:


'providers' => [
	...
 
	'Illuminate\Html\HtmlServiceProvider',
],
 
'aliases' => [
 
	...
 
	'Form'=> 'Illuminate\Html\FormFacade', 
	'HTML'=> 'Illuminate\Html\HtmlFacade',
],

After that you will have access to the {{ Form::open() }} and other HTML helpers. Use the following command to test it’s working.


php artisan tinker
> Form::text('foo')
"<input name=\"foo\" type=\"text\">"

4 Replies to “How to Install Illuminate/HTML In Laravel 5”

  1. 七片

    Thanks for every other wonderful post. Where else may just anyone get that kind
    of info in such an ideal method of writing?
    I have a presentation subsequent week, and I’m on the search for such information.

  2. Bishal

    Very good website design. I wanted to say that in adding the php syntax in config/app.php, the syntax in laravel 5 app.php is completely different. It ends with class at the end. So the above lines are not working. Even the aliases syntax is different to the code you have written. so the last commands in the console does not work. Thanks

    • Jonny Edwards

      Hey Bishal,

      you’ll want to add the aliases as:

      ‘Form’ => IlluminateHtmlFormFacade::class,
      ‘HTML’ => IlluminateHtmlHtmlFacade::class

      and the provider as
      IlluminateHtmlHtmlServiceProvider::class

Leave a Reply

Your email address will not be published. Required fields are marked *