How to Install HTML / Form helper In Laravel 5

Laravel 4 included by default Form helpers package called HTML, but it was removed from Laravel 5. HTML package is still available, but you need to install it with composer. Follow these below instructions to use HTML and Form package again.

Require the package with Composer

Type composer require to add the package to your project. Please note that the HTML package is now supported by LaravelCollective group (“illuminate/html” => “laravelcollective/html”)

composer require "laravelcollective/html"
composer update

Add service provider and aliases

Open /config/app.php, add provider and aliases:

  'providers' => [
    # ...

  # ...

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

That’s it! You can now include Form and HTML package in your controllers.  You can test with artisan  tinker:

$ php artisan tinker
>>> Form::text('name')
=> Illuminate\Support\HtmlString {#639}


Add a comment