Laravel Form Builder
Generate complex, responsive HTML forms directly from Laravel classes, complete with automatic validation, localization, and seamless frontend integration.
Field blocks
Drag a block onto the form, or press Enter on it. Reorder with the arrow buttons.
use Hyderkamran\FormBuilder\Models\Form;
use Hyderkamran\FormBuilder\Models\FormField;
use Hyderkamran\FormBuilder\Enums\FieldType;
$form = Form::create([
'title' => 'Contact Us',
'slug' => 'contact-us',
'description' => 'We would love to hear from you.',
'is_active' => true,
]);
// Add a block to generate its FormField
Rules live on each field
Every field carries its own required flag and validation rules, and can show or hide itself based on another field's value. Try the country below.
- is_required
- false
- validation_rules
- none
- options.logic
- country = pk, show
Logic matched: the Province field is shown.
FormField::create([
// ... other attributes
'options' => [
'logic' => [
'field' => 'country', // watch this field
'operator' => '=', // =, !=, >, <
'value' => 'pk', // match this value
'action' => 'show', // 'show' or 'hide'
],
],
]);
- =
- !=
- >
- <
- operators, with a
showorhideaction. Also set in the admin UI under the Logic tab.
A form system, not just a form tag
Build
- 21 field types, text to repeater
- Drag-and-drop admin UI
- Database-driven form definitions
- Repeater fields with nested rows
Validate
- Dynamic validation, per-field rules
- Conditional show and hide logic
- File and image upload support
Deliver
- Blade directive @form('slug')
- Embeddable iframe mode
- JSON API endpoints
- Caching layer
After submit
- Export to CSV, Excel and PDF
- Email notifications
- Webhook support
- PSR-4, Laravel package conventions
One definition, every place a form goes
- Form definitionStored in the database · then Blade directive, Iframe embed, JSON API
- Blade directive@form('contact-us') · then Submission
- Iframe embed/forms/{slug}/embed · then Submission
- JSON APISchema and submit · then Submission
- SubmissionValidated per field · then Email, Webhook, Export
- EmailNotifications
- WebhookPer form
- ExportCSV, Excel, PDF
21 field types in six groups
Basic8
textemailnumbertextareapasswordhiddenurltelChoice4
selectradiocheckboxtoggleDate and time3
datedatetimetimeMedia2
fileimageSpecial3
rangecolorratingPro1
repeater
An admin for editors, JSON for everything else
| Dashboard | /forms/admin |
|---|---|
| Create form | /forms/admin/create |
| Edit form | /forms/admin/{id}/edit |
| Submissions | /forms/admin/{id}/submissions |
To protect the admin, set admin_middleware to ['web', 'auth'].
- GET
/api/form-builder/forms/{slug}Form schema (JSON) - POST
/api/form-builder/forms/{slug}/submitSubmit (JSON)
curl -X POST https://your-app.com/api/form-builder/forms/contact-us/submit \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "Alice", "email": "alice@example.com"}'
Publish, migrate, build
Laravel Form Builder is maintained in the open, versioned semantically, and used in our own client projects — so fixes land upstream rather than in a private fork.
composer require hyderkamran/laravel-form-builder
# Config
php artisan vendor:publish --tag=form-builder-config
# Migrations
php artisan vendor:publish --tag=form-builder-migrations
php artisan migrate
# Frontend assets (drag-and-drop and conditional logic)
php artisan vendor:publish --tag=form-builder-assets
From the package README on GitHub
| Package | hyderkamran/laravel-form-builder |
|---|---|
| Licence | MIT |
| Language | PHP / Laravel |
| Requires | PHP ^8.1Laravel 10 or 11 |
| Maintained by | ApexlyTech, in the open on GitHub |
Stop hand-writing the same form twice
Generate complex, responsive HTML forms directly from Laravel classes, complete with automatic validation, localization, and seamless frontend integration.