What is Forms in Laravel?. The Complete Laravel Developer Course 2022 [Videos].

Laravel provides various in built tags to handle HTML forms easily and securely. All the major elements of HTML are generated using Laravel. To support this, we need to add HTML package to Laravel using composer.

Example 1

Step 1 − Execute the following command to proceed with the same.

composer require illuminate/html

Step 2 − This will add HTML package to Laravel as shown in the following image.

HTML Package

Step 3 − Now, we need to add the package shown above to Laravel configuration file which is stored at config/app.php. Open this file and you will see a list of Laravel service providers as shown in the following image. Add HTML service provider as indicated in the outlined box in the following image.

Laravel Service

Step 4 − Add aliases in the same file for HTML and Form. Notice the two lines indicated in the outlined box in the following image and add those two lines.

Outlined Box

Step 5 − Now everything is setup. Lets see how we can use various HTML elements using Laravel tags.

Opening a Form

Generating a Label Element

Generating a Text Input

Specifying a Default Value

Generating a Password Input

Generating a File Input

Generating a Checkbox Or Radio Input

Generating a Checkbox Or Radio Input That Is Checked

Generating a Drop-Down List

Generating A Submit Button

Example 2

Step 1 − Copy the following code to create a view called



Step 2 − Add the following line in app/Http/routes.php to add a route for view form.php


Step 3 − Visit the following URL to see the form.


Step 4 − The output will appear as shown in the following image.

View Form

See All

Comments (493 Comments)

Submit Your Comment

See All Posts

Related Posts

Laravel / Blog

How to install Laravel ?

For managing dependencies, Laravel uses composer. Make sure you have a Composer installed on your system before you install Laravel. In this chapter, you will see the installation process of Laravel.
14-Feb-2022 /15 /493

Laravel / Blog

What is Laravel - Application Structure?

The application structure in Laravel is basically the structure of folders, sub-folders and files included in a project. Once we create a project in Laravel, we get an overview of the application structure as shown in the image here.
14-Feb-2022 /15 /493

Laravel / Blog

How to setup Configuration in Laravel?

n the previous chapter, we have seen that the basic configuration files of Laravel are included in the config directory. In this chapter, let us discuss the categories included in the configuration.
14-Feb-2022 /15 /493