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
Routing - Laravel 7/8 Routing Example
Routing - Laravel 7/8 Routing...

In this article, we will give you information about the basic route, named route, and advanced route in laravel 7 and la...

Read More

Nov-01-2020

Login with Mobile Number using Laravel Custom Auth
Login with Mobile Number using...

In this tutorial i will show you how to login with mobile number in laravel using Laravel Custom Auth , laravel pro...

Read More

Jun-18-2021

How To Get Element By Data Attribute In jQuery
How To Get Element By Data Att...

In this article, we'll learn how to locate elements using data-attribute values. We can do this using jQuery and CSS...

Read More

Jul-11-2022

How To Generate RSS Feed In Laravel 9
How To Generate RSS Feed In La...

In this article, we will see how to generate an RSS feed in laravel 9. Here, we will generate an RSS feed in larave...

Read More

Dec-12-2022