rootcstar / form-builder
A Laravel form builder package
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
v1.0.62
2025-07-24 21:45 UTC
Requires
- php: ^8.3
- illuminate/encryption: ^12.0
- illuminate/support: ^12.0
- laravel/framework: ^12.0
- dev-main
- v1.0.62
- v1.0.61
- v1.0.60
- v1.0.59
- v1.0.58
- v1.0.57
- v1.0.56
- v1.0.55
- v1.0.54
- v1.0.53
- v1.0.52
- v1.0.51
- v1.0.50
- v1.0.49
- v1.0.48
- v1.0.47
- v1.0.46
- v1.0.45
- v1.0.44
- v1.0.43
- v1.0.42
- v1.0.41
- v1.0.40
- v1.0.39
- v1.0.38
- v1.0.37
- v1.0.36
- v1.0.35
- v1.0.34
- v1.0.33
- v1.0.32
- v1.0.31
- v1.0.30
- v1.0.29
- v1.0.28
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dev
This package is auto-updated.
Last update: 2026-01-24 23:01:17 UTC
README
A flexible and easy-to-use Form Builder package for Laravel applications that helps you create forms with various field types and customization options.
Installation
You can install the package via composer:
composer require rootcstar/form-builder
Publishing Assets
# Publish config php artisan vendor:publish --tag=form-builder-config # Publish views php artisan vendor:publish --tag=form-builder-views --force # Publish JavaScript php artisan vendor:publish --tag=form-builder-scripts --force
Usage
Here's a comprehensive guide on how to use the Form Builder:
Basic Form Creation
use RootCStar\FormBuilder\Forms\FormBuilder; $form = FormBuilder::create() ->formId('my-form') ->apiUrl('/api/endpoint') // API endpoint for form submission ->proxyUrl('/proxy/endpoint') // Optional proxy URL (defaults to apiUrl if not set) ->redirectUrl('/success') // Optional redirect URL after submission ->apiMethod('POST') // HTTP method (defaults to POST) ->title('Form Title') // Optional form title ->subtitle('Form Subtitle'); // Optional form subtitle
Available Field Types
Text Field
$form->textField('name', 'Full Name') ->required() ->placeholder('Enter your name') ->value('John Doe');
Number Field
$form->numberField('age', 'Age') ->required() ->min(18) ->max(100) ->value(25);
Hidden Field
$form->hiddenField('user_id', '') ->value(1);
Custom HTML Field
$form->customFieldHtml('<div class="alert alert-info">Custom HTML</div>', 'Optional Label');
File Upload Fields
// Single File Upload $form->fileField('document', 'Upload File') ->required() ->fieldWarning('Max file size: 2MB') ->accept('.pdf,.doc,.docx'); // Multiple File Upload $form->fileField('photos', 'Upload Images') ->required() ->multiple() ->accept('image/*');
Select Fields
// Basic Select $form->selectField('country', 'Select Country') ->required() ->options([ 'us' => 'United States', 'uk' => 'United Kingdom' ]) ->selected('us'); // Multiple Select $form->selectField('skills', 'Select Skills') ->required() ->multiple() ->options([ 'php' => 'PHP', 'js' => 'JavaScript', 'python' => 'Python' ]) ->selected(['php', 'js']);
Select2 Fields
// Single Select2 $form->select2Field('category', 'Select Category') ->required() ->options([ 1 => 'Category 1', 2 => 'Category 2' ]) ->selected(1); // Multiple Select2 $form->select2Field('tags', 'Select Tags') ->required() ->multiple() ->options([ 'tag1' => 'Tag 1', 'tag2' => 'Tag 2' ]) ->selected(['tag1']);
Email Field
$form->emailField('email', 'Email Address') ->required() ->placeholder('Enter your email');
Password Field
$form->passwordField('password', 'Password') ->required() ->placeholder('Enter your password');
Telephone Field
$form->telephoneField('phone', 'Phone Number') ->required() ->placeholder('Enter your phone number');
Textarea Field
$form->textAreaField('description', 'Description') ->required() ->placeholder('Enter description') ->rows(5);
Date Picker Field
$form->datePickerField('birth_date', 'Birth Date') ->required() ->fieldWarning('Format: MM/DD/YYYY') ->value('2024-01-01');
Checkbox Field
$form->checkboxField('terms', 'Terms and Conditions') ->required() ->options([ 'agree' => 'I agree to the terms', 'newsletter' => 'Subscribe to newsletter' ]) ->multiple() ->inline();
Rendering the Form
Add a submit button and render the form:
$form->submitButton('Save Changes', 'btn-primary'); return view('your.view', [ 'form' => $form->render() ]);
In your Blade view:
{!! $form !!}
Requirements
- PHP ^8.2|^8.3
- Laravel ^10.0|^11.0
License
The MIT License (MIT). Please see License File for more information.