In this small post we will solve laravel 8 form class not found error, many time we have received error like laravel 8 class 'form' not found
We have received this error message because of Laravel 8 version made changes in their library file , you can solve this issue by using "laravelcollective/html" package. laravelcollective/html package will provides you HTML and FORM class helper.
laravelcollective/html is provide html textbox, radio button, select box, checkbox and many more with laravel. They provide diffrents method to use those input fields we need to add this facade class 'collective\html\formfacade' if not added.
Using below command you can install latest and supported version of "laravelcollective html"
For laravel 8 form class not found run below command.
composer require laravelcollective/html
If you are using 5.x version then you need to add below code In app.php file.
'providers' => [ ... Collective\Html\HtmlServiceProvider::class, ... ], 'aliases' => [ ... 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, ... ],
If you are using lower laravel collective version like v5.6 or below then add code like below.
Goto your project's composer.json file to require laravelcollective/html.
composer require "laravelcollective/html":"^5.8.0"
Now, add your new provider to the providers array of config/app.php :
'providers' => [ // ... Collective\Html\HtmlServiceProvider::class, // ... ],
after that, add two class aliases to the aliases array of config/app.php
'aliases' => [ // ... 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, // ... ],