PHPackages                             iyoworks/form-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. iyoworks/form-builder

ActiveLibrary[Templating &amp; Views](/categories/templating)

iyoworks/form-builder
=====================

An Object Oriented form builder that extracts form presentation from form creation. Based on Flyn San's Form Builder.

v1.0.4(11y ago)21731MITPHPPHP &gt;=5.3.0

Since Apr 28Pushed 11y ago1 watchersCompare

[ Source](https://github.com/blessingefkt/form-builder)[ Packagist](https://packagist.org/packages/iyoworks/form-builder)[ RSS](/packages/iyoworks-form-builder/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

Laravel Form Builder
--------------------

[](#laravel-form-builder)

### A simple and intuitive form builder

[](#a-simple-and-intuitive-form-builder)

Based on

### Installation

[](#installation)

Require this package in your composer.json and run `composer update` (or run `composer require iyoworks/form-builder:1.0.*` directly):

```
"iyoworks/form-builder": "1.0.*"

```

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

```
'Iyoworks\FormBuilder\FormBuilderServiceProvider',

```

and optionally the Facade to the aliases array in the same file. This will allow for global callbacks (more on that later).

```
'FormBuilder'     => 'Iyoworks\FormBuilder\Facades\FormBuilder',

```

### Usage

[](#usage)

#### Add/Edit/Delete Fields

[](#addeditdelete-fields)

Create a form, add fields, render.

```
$form = FormBuilder::form();
$form->action('UserController@create')
//$form->add[FieldType]([field_slug] [, Field Label]);
$form->addText('first_name', 'First Name');
$form->addSelect('gender')->options(['male'=>'Male', 'female'=>'Female', 'none'=>'Not Telling']);

$form->render();
```

Need to edit or remove a field?

```
// Set field with id 'gender' to have 3 options instead of 2.
$form->getField('gender')->options(['m'=>'Male', 'f'=>'Female', 'n'=>'Not Telling']);

// Remove the gender field
$form->remove('gender');
```

Add fields exactly where you want them

```
// Add last name after first name
$form->addAfter('first_name', 'last_name', 'text');
$form->addTextAfterFirstName('last_name');
$form->addBefore('last_name', 'first_name', 'text');
$form->addTextAfterLastName('first_name');
```

Closures are also supported

```
use Iyoworks\FormBuilder\Form;
use Iyoworks\FormBuilder\Field;
// Closure support for FormBuilder
$form = FormBuilder::form(function(Form $form) {
    $form->url('users/create');
	$form->addText('first_name');
    $form->addSelect('gender'->options(['M'=>'Male', 'F'=>'Female']);
})->html();
```

```
echo $form->open(), $form->render(), $form->close();
# the same as
echo $form->html();
```

#### Field settings

[](#field-settings)

You can add fields to rows

```
$form->addRow(function($form){
    $form->addText('first_name', 'First Name')
    	->label('First Name')
    	->description('Enter your first name')
    	->columns(12);
    $form->addText('last_name', 'Last Name')
        ->label('First Name')
        ->description('Enter your last name')
        ->columns(12);
});
$form->addEmail('email', 'Email Address')
$form->addSubmit('Submit')->addClass('btn btn-block btn-primary');
```

#### Callbacks

[](#callbacks)

Callbacks can be used to render your form exactly the way you want it to look.

Supported callbacks include:

```
beforeForm(Form $form)
afterForm(Form $form)
beforeField(Form $form, Field $field)
afterField(Form $form, Field $field)
```

They can be used on a per-form basis

```
// Per-form Callbacks
$form->beforeField(function(Form $form, Field $field) {
	// Use field settings to display your form nicely
	return '' . $field->label . '';
});
```

or using the optional facade, a global basis

```
// Global form callbacks
FormBuilder::bind('beforeField', function(Form $form, Field $field) {
		return ''.$field->label.'';
	})
	->bind('afterField', function(Form $form, Field $field) {
		$output = '';
        if ( $field->description )
            $output .= '' . $field->description . '';
        return $output . '';
	});
$form = FormBuilder::form(function(Form $form) {
    $form->route('user.create');
	$form->addText('first_name', 'First Name');
	$form->addText('last_name')->label('Last Name');
});

echo $form->model($model)->html();
```

### License

[](#license)

Laravel Form Builder is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 97.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~65 days

Total

5

Last Release

4138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afc2812b654c9548b8dd575592ffea81b8d5d69c22c0f38b9721f13d9ed5bfca?d=identicon)[iyoworks](/maintainers/iyoworks)

---

Top Contributors

[![blessingefkt](https://avatars.githubusercontent.com/u/887992?v=4)](https://github.com/blessingefkt "blessingefkt (103 commits)")[![Flynsarmy](https://avatars.githubusercontent.com/u/334808?v=4)](https://github.com/Flynsarmy "Flynsarmy (3 commits)")

---

Tags

laravelbuilderform

### Embed Badge

![Health badge](/badges/iyoworks-form-builder/health.svg)

```
[![Health](https://phpackages.com/badges/iyoworks-form-builder/health.svg)](https://phpackages.com/packages/iyoworks-form-builder)
```

###  Alternatives

[infyomlabs/generator-builder

InfyOm Laravel Generator GUI Builder

132435.7k](/packages/infyomlabs-generator-builder)[laravie/html

HTML and Form Builders for the Laravel Framework

36184.6k4](/packages/laravie-html)[vluzrmos/collective-html

LaravelCollective Html and Form builder for Lumen.

2523.9k](/packages/vluzrmos-collective-html)[webup/laravel-form

A Laravel package to help build forms.

147.2k1](/packages/webup-laravel-form)[tomjamon/laravel-custom-html

Custom HTML generator for Laravel (Based on LaravelCollective HTML)

1018.6k](/packages/tomjamon-laravel-custom-html)[cornford/bootstrapper

An easy way to intergrate Twitter Bootstrap with Laravel.

232.7k](/packages/cornford-bootstrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
