You need to add parentheses to the open method. It is:
{!! Form::open() !!}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Greetings,
please help, I can't go along with Laravel 5 fundamental course because this error.
FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared()
this error came when I tried to open a Form object {!! Form::open !!}
{!! Form::close() !!}
I have tried all solution that I know from google but the problem still there.
please help
You need to add parentheses to the open method. It is:
{!! Form::open() !!}
Thanks for your response, but I have tried that and still the problem is there {!! open() !!}
please help
@boona11 it is:
{!! Form::open() !!}
You need the Form:: part too, not just open().
If that doesn't solve it can I see your composer.json file and your config/app.php file too.
You may need to run a composer update and then composer dump-autoload -o.
bindShared has been renamed to $app->singleton()
mstnorris, I have tried that command and the problem still there
HRcc, how to make this new name( $app->singleton()) effective in my application
this is my composer.json code
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.6@dev",
"illuminate/html": "5.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true
}
@HRcc Thanks HRcc the problem is solved by renaming the bindShared() to singleton()
Thanks for everybody here :)
@boona11 where can I find bindShared()
@michoshow It is located here: /path-to-your-project/vendor/illuminate/html/HtmlServiceProvider.php
Use the laravelcollective/html package instead of illuminate/html going forward.
How to change over cleanly:
First, comment out the references to Illuminate\Html in your config/app.php. (Don't remove them, you're going to change them in a minute.)
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.
If it works, you might get an error "Undefined variable: errors (view ... path to view). In which case, update your routes.php file to use the new 'web' middleware.
Route::group(['middleware' => ['web']], function () use ($router) { $router->resource('whatever', 'WhateverController'); });
Just a note to anyone using Entrust Roles and Permissions Package. The service provider contains
$this->app->bindShared('command.entrust.migration', function ($app) {
return new MigrationCommand();
});
$this->app->bindShared('command.entrust.classes', function ($app) {
return new ClassCreatorCommand();
});
I had the same issue until I changed them as well.
The "illuminate/html" package does not support L5.2. Replace it in your composer.json with
"laravelcollective/html": "5.2.*"
is fully compatible and actively supported. More info: https://laravelcollective.com
I installed laravelcollective since I'm using Laravel 5.2 but still can't create form using: { !! Form::open() !! } { !! Form::close() !! }
and it shows exactly same as code in browser. Any solution?
composer.json is : "require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", "laravelcollective/html": "^5.2" },
app.php is:
'provider' => Collective\Html\HtmlServiceProvider::class,
'aliases'=> 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,
i fallow all steps and work'd for me https://laravelcollective.com/docs/5.1/html#installation
@philsown 's answer should be accepted as the right one. Especially when working with Laravel 5.2
On the other hand, the original question dates back 6 months...
Thank you this was a huge help! It's still installing as bindShared so a quick change and wala up and running again.
@philsown - Thanks, quick question though:
When I'm running composer remove illuminate/html I get - "Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring."
EDIT: Found an excellent source http://stackoverflow.com/questions/35151478/laravel-upgrading-to-5-2-0-from-5-1-error/35151551#answer-35159166
Sorry to open this question.
I would to like to know why this solution does not include in master file?
Tanks guys
Thank you very much as this solved the issue for me as well. The methods are called on lines 36 and 49 of Illuminate\Html\HtmlServiceProvider.php. I performed a hard refresh and my form appeared again and is working. Will this be included in future packages pulled by Composer or is there another way to have it automatically set as this happened in a new Laravel project and Composer install. Thanks!
i have install two package cartalyst-Strip and cartalyst-sentinel package in my project which is in the "vendor/cartalyst" when i want to call any cartalyst-Strip method like make stripe token/customer/card/charges its give me an error like Call to undefined method Cartalyst\Stripe\Laravel\Facades\Stripe::tokens(), Call to undefined method Cartalyst\Stripe\Laravel\Facades\Stripe::customers(), Call to undefined method Cartalyst\Stripe\Laravel\Facades\Stripe::charges() etc what i do wrong? i have tried same code in fresh laravel project and only use cartalyst-Strip package and every thing working fine
Sorry fox i found my blunder i used new stripe(key) instead of stripe::make(key).
Please or to participate in this conversation.