Laravel 9 Form Class Not Found

Websolutionstuff | Sep-19-2022 | Categories : Laravel

In this article, we will fix the laravel 9 form class not found error, many times we have received errors like laravel 9 class 'form' not found. The Laravel Collective package HTML comes packed with an HTML and FORM generator allowing you to handle easy-to-manage forms in your blade files as well as intricate model binding to your forms.

We have received this error message because of laravel 9 version made changes in their library file, you can solve this issue by using the "laravelcollective/html" package. laravelcollective/html package will provide you with HTML and FORM class helper.

laravelcollective/html is provide html textbox, radio button, select box, checkbox, and many more with laravel. They provide different methods to use those input fields we need to add this facade class 'collective\html\formfacade' if not added.

So, let's see the class 'form' not found in laravel 9 and how to install laravel collective in laravel 9.

For the laravel 9 form class not found run the below command and install the latest and supported version of "laravelcollective html".

composer require laravelcollective/html

 

 

If you are using the 5.x version then you need to add the below code In the app.php file.

'providers' => [
    ...
    Collective\Html\HtmlServiceProvider::class,
    ...
  ],
'aliases' => [
      ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
      ...
  ],

 

If you are using a lower laravel collective version like v5.6, v5.5, or below then add code like the 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 provider's 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,
    // ...
  ],

 

 

If you can use greater than the v5.6 version then we just need to run single command no other changes are required in any files.

$ composer require laravelcollective/html

 


You might also like :

Recommended Post
Featured Post
How To Check Array Is Empty Or Null In Javascript
How To Check Array Is Empty Or...

In this example, I will show you how to check if an array is empty or null in javascript or jquery. When we are wor...

Read More

Aug-18-2020

Laravel 9 REST API With Passport Authentication
Laravel 9 REST API With Passpo...

In this article, we will see an example of laravel 9 REST API with passport authentication. Also, perform CRUD...

Read More

Mar-13-2022

Laravel 9 One To Many Polymorphic Relationship
Laravel 9 One To Many Polymorp...

In this article, we will see laravel 9 one to many polymorphic relationship. A one-to-many polymorphic relation is...

Read More

Apr-05-2022

How To Get Current User Location In Laravel 9
How To Get Current User Locati...

In this article, we will see how to get the current user location in laravel 9. Many times we are required to...

Read More

Mar-23-2022