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 Send Email In Laravel 9 Using Mailtrap
How To Send Email In Laravel 9...

In this article, we will explore the process of sending emails in Laravel 9 using Mailtrap. We will delve into how Larav...

Read More

Jul-27-2022

Laravel 10 Send Mail using Markdown Template
Laravel 10 Send Mail using Mar...

Hey everyone! Ever wondered how to make your Laravel emails look sleek and professional? In this guide, I'll walk yo...

Read More

Dec-04-2023

Laravel 9 Insert Multiple Records In Database
Laravel 9 Insert Multiple Reco...

In this article, we will see laravel 9 insert multiple records in the database. Here, we will learn how to ins...

Read More

Dec-16-2022

Helper Function Example in Laravel 8
Helper Function Example in Lar...

Hello All, In this post we will see helper function example in laravel, Laravel provide in-buit global "hel...

Read More

Jun-22-2021