Need help with bootforms?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

431 Stars 100 Forks MIT License 136 Commits 25 Opened issues


Rapid form generation with Bootstrap 3 and Laravel.

Services available


Need anything else?

Contributors list

Important: This package is not actively maintained. For bug fixes and new features, please fork.


This Project Has Been Deprecated. Code Climate Coverage Status

BootForms builds on top of my more general 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

You can install this package via Composer by running this command in your terminal in the root of your project:

composer require adamwathan/bootforms


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

Modify the

array in
to include the
'providers' => [

Add the

facade to the
array in
'aliases' => [
    'BootForm' => 'AdamWathan\BootForms\Facades\BootForm'

You can now start using BootForms by calling methods directly on the

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

Outside of Laravel

Usage outside of Laravel 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

when not using the implementations meant for Laravel.

Using BootForms

Basic Usage

BootForms lets you create a label and form control and wrap it all in a form group in one call.

// // //
// {!! BootForm::open() !!} {!! BootForm::text('Field Label', 'field_name') !!} {!! BootForm::close() !!}

Note: Don't forget to

forms before trying to create fields! BootForms needs to know if you opened a vertical or horizontal form before it can render a field, so you'll get an error if you forget.

Customizing 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.

Attributes can be added either via the

method, or by simply using the attribute name as the method name.
// // //
BootForm::text('First Name', 'first_name')->placeholder('John Doe');


// // // Red // Green // //
BootForm::select('Color', 'color')->options(['red' => 'Red', 'green' => 'Green'])->select('green');




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

For more information about what's possible, check out the documentation for my basic Form package.

Reduced Boilerplate

Typical Bootstrap form boilerplate might look something like this:


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::date('Date of Birth', 'date_of_birth') !!}
  {!! BootForm::email('Email', 'email') !!}
  {!! BootForm::password('Password', 'password') !!}
  {!! BootForm::submit('Submit') !!}
{!! BootForm::close() !!}

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:

{!! $errors->first('first_name', '


') !!}

And reduces it to this:

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

...with the

class being added automatically if there is an error in the session.

Horizontal Forms

To use a horizontal form instead of the standard basic form, simply swap the

call with a call to
// Width in columns of the left and right side
// for each breakpoint you'd like to specify.
$columnSizes = [
  'sm' => [4, 8],
  'lg' => [2, 10]

{!! BootForm::openHorizontal($columnSizes) !!} {!! 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() !!}

Additional Tips

Hiding Labels

You can hide labels by chaining the

helper off of any element definition.

BootForm::text('First Name', 'first_name')->hideLabel()

The label will still be generated in the markup, but hidden using Bootstrap's

class, so you don't reduce the accessibility of your form.

Help Blocks

You can add a help block underneath a form element using the


BootForm::text('Password', 'password')->helpBlock('A strong password should be long and hard to guess.')

Note: This help block will automatically be overridden by errors if there are validation errors.

Model Binding

BootForms makes it easy to bind an object to a form to provide default values. Read more about it here.

BootForm::open()->action( route('users.update', $user) )->put()

Related Resources

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.