1

Inside config/app.php file, I added the service provider to the list:

'Illuminate\Html\HtmlServiceProvider',

And added the aliases:

'Form'      => 'Illuminate\Html\FormFacade',
'Html'      => 'Illuminate\Html\HtmlFacade',

But I get:

FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared()

SidOfc
  • 4,552
  • 3
  • 27
  • 50
Jonh Doe
  • 761
  • 1
  • 9
  • 25

3 Answers3

1

Solution 1 Go to the file Illuminate\Foundation\Application and replace bindShare with singleton. This will solve your problem.

bindShared has been renamed to $app->singleton().

This would change the core files and is nit recommended. But if are just looking for a quick fix, this would help. But I strongly suggest you to follow the second solution.

Solution 2

The main problem is because you are using the package Illuminate/HTML which is no longer mainted. You can use Laravelcollective/HTML instead of this.

First, comment out the references to Illuminate\Html in your config/app.php.

Next, do composer remove illuminate/html.

After that, do composer require laravelcollective/html.

Now uncomment the Illuminate\Html items in your config/app.php file and update references to Collective\Html instead of Illuminate\Html.

Jilson Thomas
  • 7,165
  • 27
  • 31
  • "Solution 1" should be removed. First, modifying core files is rarely a good solution. Second, the way it is worded, it sounds like you're saying to rename a method in `Illuminate\Foundation\Application`, which would cause many issues. "Solution 2" is correct. – patricus Feb 16 '16 at 19:01
1

I think you should follow below steps to add HTML and FORM classes in laravel 5.

first open composer.JSON file and write following line after "laravel/framework": "5.2.*" put comma(,) at last

         "laravelcollective/html": "5.2.*"

        now open command promt and type command "composer update"
        It will take some time to upgrade.

        after complete upgradation Register the service provider in config/app.php by adding the following value into the providers array:

            Collective\Html\HtmlServiceProvider::class,

        Register facades by adding these two lines in the aliases array:

         'Form' => Collective\Html\FormFacade::class,
         'Html' => Collective\Html\HtmlFacade::class,

Hope this will solve your problem.

Wasim
  • 99
  • 11
0

See this post
htmlserviceprovider

Community
  • 1
  • 1
paranoid
  • 6,799
  • 19
  • 49
  • 86