PHPackages                             barbuslex/bootforms - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. barbuslex/bootforms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

barbuslex/bootforms
===================

Just a Formbuilder with some Bootstrap specific conveniences. Remembers old input, retrieves error messages and handles all your boilerplate Bootstrap markup automatically. (Based on adamwathan/bootforms)

1.0(11y ago)028MITPHPPHP &gt;=5.3.0

Since Jun 4Pushed 11y ago1 watchersCompare

[ Source](https://github.com/barbuslex/bootforms)[ Packagist](https://packagist.org/packages/barbuslex/bootforms)[ RSS](/packages/barbuslex-bootforms/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

BootForms
=========

[](#bootforms)

Based on adamwathan/bootforms with bugfix and Laravel 4 normalization :

Use :

```
{{ BootForm::text(name, value) }}
```

Insted Of:

```
{{ BootForm::text(value, name) }}
```

BootForms builds on top of my more general [Form](https://github.com/adamwathan/form) package by adding another layer of abstraction to rapidly generate markup for standard Bootstrap 3 forms. Probably not perfect for your super custom branded ready-for-release apps, but a *huge* time saver when you are still in the prototyping stage!

Installing with Composer
------------------------

[](#installing-with-composer)

You can install this package via Composer by including the following in your `composer.json`:

```
{
    "require": {
        "barbuslex/bootforms": "1.0"
    }
}
```

*Note: you could also require `dev-master` to test the latest version, but make sure you drop your `minimum-stability` to `dev`.*

### Laravel 4

[](#laravel-4)

If you are using Laravel 4, you can get started very quickly by registering the included service provider.

Modify the `providers` array in `app/config/app.php` to include the `BootFormsServiceProvider`:

```
'providers' => array(
		//...
		'AdamWathan\BootForms\BootFormsServiceProvider'
	),
```

Add the `BootForm` facade to the `aliases` array in `app/config/app.php`:

```
'aliases' => array(
		//...
		'BootForm' => 'AdamWathan\BootForms\Facades\BootForm'
	),
```

You can now start using BootForms by calling methods directly on the `BootForm` facade:

```
BootForm::text('email', 'Email');
```

### Outside of Laravel 4

[](#outside-of-laravel-4)

Usage outside of Laravel 4 is a little trickier since there's a bit of a dependency stack you need to build up, but it's not too tricky.

```
$formBuilder = new AdamWathan\Form\FormBuilder;

$formBuilder->setOldInputProvider($myOldInputProvider);
$formBuilder->setErrorStore($myErrorStore);
$formBuilder->setToken($myCsrfToken);

$basicBootFormsBuilder = new AdamWathan\BootForms\BasicFormBuilder($formBuilder);
$horizontalBootFormsBuilder = new AdamWathan\BootForms\HorizontalFormBuilder($formBuilder);

$bootForm = new AdamWathan\BootForms\BootForm($basicBootFormsBuilder, $horizontalBootFormsBuilder);
```

> Note: You must provide your own implementations of `AdamWathan\Form\OldInputInterface` and `AdamWathan\Form\ErrorStoreInterface` when not using the implementations meant for Laravel 4.

Using BootForms
---------------

[](#using-bootforms)

### Reduced Boilerplate

[](#reduced-boilerplate)

Typical Bootstrap form boilerplate might look something like this:

```

    First Name

    Last Name

    Date of Birth

    Email address

    Password

  Submit

```

Using the Laravel 4 `FormBuilder`, you would normally be able to get that down to this:

```
{{ Form::open() }}

    {{ Form::label('first_name', 'First Name', array('class' => 'control_label')) }}
    {{ Form::text('first_name', null, array('class' => 'form-control')) }}

    {{ Form::label('last_name', 'Last Name', array('class' => 'control_label')) }}
    {{ Form::text('last_name', null, array('class' => 'form-control')) }}

    {{ Form::label('date_of_birth', 'Date of Birth', array('class' => 'control_label')) }}
    {{ Form::text('date_of_birth', null, array('class' => 'form-control')) }}

    {{ Form::label('email', 'Email', array('class' => 'control_label')) }}
    {{ Form::email('email', null, array('class' => 'form-control')) }}

    {{ Form::label('password', 'Password', array('class' => 'control_label')) }}
    {{ Form::password('password', array('class' => 'form-control')) }}

  {{ Form::submit('Submit', array('class' => 'btn btn-default')) }}
{{ Form::close() }}
```

BootForms makes a few decisions for you and allows you to pare it down a bit more:

```
{{ BootForm::open() }}
	{{ BootForm::text('first_name', 'First Name') }}
	{{ BootForm::text('last_name', 'Last Name') }}
	{{ BootForm::text('date_of_birth', 'Date of Birth') }}
	{{ BootForm::email('email', 'Email') }}
	{{ BootForm::password('password', 'Password') }}
	{{ BootForm::submit('Submit') }}
{{ BootForm::close() }}
```

### Automatic Validation State

[](#automatic-validation-state)

Another nice thing about BootForms is that it will automatically add error states and error messages to your controls if it sees an error for that control in the error store.

Essentially, this takes code that would normally look like this:

```

	First Name

  {{ $errors->first('first_name', ':message') }}

```

And reduces it to this:

```
{{ BootForm::text('First Name', 'first_name') }}
```

...with the `has-error` class being added automatically if there is an error in the session.

### Horizontal Forms

[](#horizontal-forms)

To use a horizontal form instead of the standard basic form, simply swap the `BootForm::open()` call:

```
// Width in columns of the left and right side
$labelWidth = 2;
$controlWidth = 10;

{{ BootForm::openHorizontal($labelWidth, $controlWidth) }}
  {{ BootForm::text('first_name', 'First Name') }}
  {{ BootForm::text('last_name', 'Last Name') }}
  {{ BootForm::text('date_of_birth', 'Date of Birth') }}
  {{ BootForm::email('email', 'Email') }}
  {{ BootForm::password('password', 'Password') }}
  {{ BootForm::submit('Submit') }}
{{ BootForm::close() }}
```

### Customizing Form Elements

[](#customizing-form-elements)

If you need to customize your form elements in any way (such as adding a default value or placeholder to a text element), simply chain the calls you need to make and they will fall through to the underlying form element:

```
//
//    First Name
//
//
BootForm::text('first_name', 'First Name')->placeholder('John Doe');
```

For more information about what's possible, check out the documentation for [my basic Form package.](https://github.com/adamwathan/form)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.8% 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

Unknown

Total

1

Last Release

4365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/893d332a269cb2b774937c5b80690629d7948b776f326571c94f4cccf4ad5d0d?d=identicon)[Barbuslex](/maintainers/Barbuslex)

---

Top Contributors

[![adamwathan](https://avatars.githubusercontent.com/u/4323180?v=4)](https://github.com/adamwathan "adamwathan (31 commits)")[![barbuslex](https://avatars.githubusercontent.com/u/113057?v=4)](https://github.com/barbuslex "barbuslex (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/barbuslex-bootforms/health.svg)

```
[![Health](https://phpackages.com/badges/barbuslex-bootforms/health.svg)](https://phpackages.com/packages/barbuslex-bootforms)
```

###  Alternatives

[redot/laravel-toastify

A simple package to use toastify.js in laravel applications

109.7k](/packages/redot-laravel-toastify)

PHPackages © 2026

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