Laravel 7 Form Component Package

Zainal Hasan |

Problem

Writing a form code is very exhausting. I tried to write clean code as simple as possible. As mentioned in my article before, we must never reuse code from other projects. For example, we have to write a create and update form for a ton of resources. Working with a small team will make this task not efficient.

Immobility. You cannot reuse parts of the code in other projects because of involved risks and high effort

TL;DR

Check the package at https://github.com/zhanang19/form-component

Solution

Cause that, this week I work to create a form component package. This package will generate the form field using Laravel 7 Blade Component.

Usage

Basic usage of this package
Basic usage of this package.


Feature

  • Automatically guess label from the name attribute
  • Attach error message
  • Template customization
  • Attach custom class to form wrapper
  • Label and help text slot

Hopefully, this package will help you writing form code more efficiently. Thank you for reading, and have a nice day!

Note: This package only works for Laravel 7. If you're working with the earlier Laravel version, check this awesome FormField package for Bootstrap as an alternative.

Related post