15

How to Install Illuminate/HTML In Laravel 5

Posted (Updated ) in PHP

Laravel 4 contained a Form helpers package called HTML but it was removed from 5 to cut down on cruft. HTML is still available as a first party package though so below are instructions on getting it back.

First require it in:

1
composer require "illuminate/html":"5.0.*"

Next up add the service provider and aliases. Open /config/app.php and update as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
'providers' => [
	...
 
	'Illuminate\Html\HtmlServiceProvider',
],
 
'aliases' => [
 
	...
 
	'Form'=> 'Illuminate\Html\FormFacade', 
	'Html'=> 'Illuminate\Html\HtmlFacade',
],

That’s it. To confirm it’s working use the following:

1
2
3
php artisan tinker
> Form::text('foo')
"<input name=\"foo\" type=\"text\">"
  • [UnexpectedValueException]
    Could not parse version constraint :5.0.*: Invalid version string “:5.0.*”

    • flynsarmy

      Sounds like you typed it in wrong.

      • I ended up not specifying a version, it just defaulted to the 5.0 stable branch. I was very confused, new to this framework stuff. I really appreciate your write ups / tutorials. You’re helping grow the Laravel community! I thought this was going to be insanely hard but you’re write ups are straight and to the point. After I finish the todo app, I’ll be able to understand more technical jargon that scared me away when I first looked at Laravel. :]

  • Thank you for this…

  • [SymfonyComponentDebugExceptionFatalErrorException
    Class ‘IlluminateHtmlHtmlServiceProvider’ not found

    • Andrew

      Had the same problem, you need to composer install or composer update before editing config/app.php

    • Sachiko Nee

      open your composer.json
      add “illuminate/html”: “~5.0.*” to the require bracket

      “require”: {
      “php”: “>=5.5.9”,
      “laravel/framework”: “5.1.*”,
      “illuminate/html”: “~5.0.*”
      },

      go back to your terminal to confirm it.

  • I’m using the laravelcollective/html. I heard that this is an update version with many community involve in maintaining the package. But somehow, I found out that it does not really support the Html::image().. it just returns error in the view blade. Have your tried the package?

  • to install Illuminate/HTML on laravel 5.1 ,follow this link
    http://laravelcollective.com/docs/5.1/html

  • Please fix the HTML to Html. Otherwise it does not work.

    Took me a while to realize this. http://stackoverflow.com/questions/28847726/laravel-5-class-html-not-found

    • flynsarmy

      Fixed, thanks for the correction.

  • Tommy

    As of release of Laravel 5.2, Illuminate/HTML package has been deprecated.

    Do this:

    In cmd run command:

    composer require laravelcollective/html

    In your composer.json file in “require” group should be added this line:

    “laravelcollective/html”: “5.2.*”

    Update composer with command:

    composer update

    In config/app.php add this lines:

    in providers group:

    CollectiveHtmlHtmlServiceProvider::class,

    in aliases group:

    ‘Form’ => CollectiveHtmlFormFacade::class,

    ‘Html’ => CollectiveHtmlHtmlFacade::class,

    Source: http://laravel.io/forum/12-27-2015-install-formbuilder-on-laravel-52?page=1#reply-29370

    • Captain Hypertext

      You sir, are the lara-bomb.

      • Tommy

        Well I just hate when you find a solution on the Net only to realize it doesn’t apply to your situation. Update to the article would be more appropriate than my comment since not a lot of people will find it this way.

  • Amit Juneja

    This will work if you go to vendor/illuminate/HtmlServiceProvider.php and change “bind_shared” to “singleton”.
    There will be two instances of bind_shared in this file