PHPackages                             mitris/bootstrap-form - 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. mitris/bootstrap-form

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

mitris/bootstrap-form
=====================

Laravel 5 form wrappers for Bootstrap 3.

1.0.16(9y ago)0103MITPHPPHP &gt;=5.4.0

Since Jun 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mitris/bootstrap-form)[ Packagist](https://packagist.org/packages/mitris/bootstrap-form)[ RSS](/packages/mitris-bootstrap-form/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (33)Used By (0)

BootstrapForm, forms for Laravel 5
==================================

[](#bootstrapform-forms-for-laravel-5)

[![Circle CI](https://camo.githubusercontent.com/a8473dce1d099cf4ce01faae7ed0ce1b3e2545dd80c232d9d9b07e85f4185361/68747470733a2f2f636972636c6563692e636f6d2f67682f647769676874776174736f6e2f626f6f7473747261702d666f726d2f747265652f6d61737465722e7376673f7374796c653d736869656c64)](https://circleci.com/gh/dwightwatson/bootstrap-form/tree/master)[![Total Downloads](https://camo.githubusercontent.com/451d63de0ce650cb2d4b5ba74bab452b817bd5b83d7270a5025bec04fe3a7a17/68747470733a2f2f706f7365722e707567782e6f72672f776174736f6e2f626f6f7473747261702d666f726d2f646f776e6c6f6164732e737667)](https://packagist.org/packages/watson/bootstrap-form)[![Latest Stable Version](https://camo.githubusercontent.com/b96ae2c3516d6723655469fcc27c9682c2a044e0fa274141464aefc4a515e8be/68747470733a2f2f706f7365722e707567782e6f72672f776174736f6e2f626f6f7473747261702d666f726d2f762f737461626c652e737667)](https://packagist.org/packages/watson/bootstrap-form)[![Latest Unstable Version](https://camo.githubusercontent.com/a50e64f8f090ae20e782c9d24086726a322d78e2bf8c3a63d50e9630714c6d5c/68747470733a2f2f706f7365722e707567782e6f72672f776174736f6e2f626f6f7473747261702d666f726d2f762f756e737461626c652e737667)](https://packagist.org/packages/watson/bootstrap-form)[![License](https://camo.githubusercontent.com/af06afb536bb3ccb86f9b1f4ad768899274d78c3efb2aec6dd51a6d6d4b911a2/68747470733a2f2f706f7365722e707567782e6f72672f776174736f6e2f626f6f7473747261702d666f726d2f6c6963656e73652e737667)](https://packagist.org/packages/watson/bootstrap-form)

This is a package for simply creating Bootstrap 3 styled form groups in Laravel 5. It extends the normal form builder to provide you with horizontal form groups completed with labels, error messages and appropriate class usage.

Introduction
------------

[](#introduction)

Simply use the `BootstrapForm` facade in the place of the `Form` facade when you want to generate a Bootstrap 3 form group.

```
BootForm::text('username');
```

And you'll get back the following:

```

    Username

```

Of course, if there are errors for that field it will even populate them.

```

    Username

        The username field is required.

```

Installation
------------

[](#installation)

First, require the package using Composer.

```
composer require watson/bootstrap-form
```

Now, add these service providers to your `config/app.php` file (don't add the `HtmlServiceProvider` if you already have it).

```
Collective\Html\HtmlServiceProvider::class,
Watson\BootstrapForm\BootstrapFormServiceProvider::class,
```

And finally add these to the aliases array (note: Form and Html must be listed before BootstrapForm):

```
'Form'     => Collective\Html\FormFacade::class,
'HTML'     => Collective\Html\HtmlFacade::class,
'BootForm' => Watson\BootstrapForm\Facades\BootstrapForm::class,
```

Feel free to use a different alias for BootstrapForm if you'd prefer something shorter.

Configuration
-------------

[](#configuration)

There are a number of configuration options available for BootstrapForm. Run the following Artisan command to publish the configuration option to your `config` directory:

```
php artisan vendor:publish
```

### Horizontal form sizes

[](#horizontal-form-sizes)

When using a horizontal form you can specify here the default sizes of the left and right columns. Note you can specify as many classes as you like for each column for improved mobile responsiveness, for example:

```
col-md-3 col-sm-6 col-xs-12

```

### Display errors

[](#display-errors)

By default this package will only display the first validation error for each field. If you'd instead like to list out all the validation errors for a field, simply set this configuration option to true.

Usage
-----

[](#usage)

### Opening a form

[](#opening-a-form)

BootstrapForm has improved the process of opening forms, both in terms of providing Bootstrap classes as well as managing models for model-based forms.

```
// Passing an existing, persisted model will trigger a model
// binded form.
$user = User::whereEmail('example@example.com')->first();

// Named routes
BootForm::open(['model' => $user, 'store' => 'users.store', 'update' => 'users.update']);

// Controller actions
BootForm::open(['model' => $user, 'store' => 'UsersController@store', 'update' => 'UsersController@update']);
```

If a model is passed to the open method, it will be configured to use the `update` route with the `PUT` method. Otherwise it will point to the `store` method as a `POST` request. This way you can use the same opening tag for a form that handles creating and saving.

```
// Passing a model that hasn't been saved or a null value as the
// model value will trigger a `store` form.
$user = new User;

BootForm::open()
```

### Form variations

[](#form-variations)

There are a few helpers for opening the different kinds of Bootstrap forms. By default, `open()` will use the the form style that you have set in the configuration file. These helpers take the same input as the `open()` method.

```
// Open a vertical Bootstrap form.
BootForm::vertical();

// Open an inline Bootstrap form.
BootForm::inline();

// Open a horizontal Bootstrap form.
BootForm::horizontal();
```

If you want to change the columns for a form for a deviation from the settings in your configuration file, you can also set them through the `$options` array.

```
BootForm::open(['left_column_class' => 'col-md-2', 'left_column_offset_clsas' => 'col-md-offset-2', 'right_column_class' => 'col-md-10']);
```

### Text inputs

[](#text-inputs)

Here are the various methods for text inputs. Note that the method signatures are relatively close to those provided by the Laravel form builder but take a parameter for the form label.

```
// The label will be inferred as 'Username'.
BootForm::text('username');

// The field name by default is 'email'.
BootForm::email();

BootForm::textarea('profile');

// The field name by default is 'password'.
BootForm::password();
```

### Checkbox and radio button inputs

[](#checkbox-and-radio-button-inputs)

Checkboxes and radio buttons are a little bit different and generate different markup.

View the method signature for configuration options.

```
// A checked checkbox.
BootForm::checkbox('interests[]', 'Laravel', 'laravel', true);
```

Same goes for radio inputs.

```
BootForm::radio('gender', 'Male', 'male');
```

#### Multiple checkboxes and radio buttons

[](#multiple-checkboxes-and-radio-buttons)

By simply passing an array of value/label pairs you can generate a group of checkboxes or radio buttons easily.

```
$label = 'this is just a label';

$interests = [
    'laravel' => 'Laravel',
    'rails'   => 'Rails',
    'ie6'     => 'Internet Explorer 6'
];

// Checkbox inputs with Laravel and Rails selected.
BootForm::checkboxes('interests[]', $label, $interests, ['laravel', 'rails']);

$genders = [
    'male'   => 'Male',
    'female' => 'Female'
];

// Gender inputs inline, 'Gender' label inferred.
BootForm::radios('gender', null, $genders, null, true);

// Gender inputs with female selected.
BootForm::radios('gender', 'Gender', $genders, 'female');
```

### Submit button

[](#submit-button)

```
// Pretty simple.
BootForm::submit('Login');
```

### Closing the form

[](#closing-the-form)

```
// Pretty simple.
BootForm::close();
```

### Help Text

[](#help-text)

You may pass a `help_text` option to any field to have [Bootstrap Help Text](https://getbootstrap.com/css/#forms-help-text) appended to the rendered form group.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~27 days

Recently: every ~35 days

Total

32

Last Release

3509d ago

Major Versions

0.8.6 → 1.0.02015-06-02

PHP version history (2 changes)0.8.0PHP &gt;=5.3.0

0.9.0PHP &gt;=5.4.0

### Community

Maintainers

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

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (88 commits)")[![rikh42](https://avatars.githubusercontent.com/u/715133?v=4)](https://github.com/rikh42 "rikh42 (11 commits)")[![SystemF](https://avatars.githubusercontent.com/u/6906350?v=4)](https://github.com/SystemF "SystemF (11 commits)")[![martynling](https://avatars.githubusercontent.com/u/2652603?v=4)](https://github.com/martynling "martynling (8 commits)")[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (3 commits)")[![aeons](https://avatars.githubusercontent.com/u/1432894?v=4)](https://github.com/aeons "aeons (2 commits)")[![m3di](https://avatars.githubusercontent.com/u/14237264?v=4)](https://github.com/m3di "m3di (2 commits)")[![lsdevries](https://avatars.githubusercontent.com/u/1443521?v=4)](https://github.com/lsdevries "lsdevries (1 commits)")[![tanmuhittin](https://avatars.githubusercontent.com/u/7202383?v=4)](https://github.com/tanmuhittin "tanmuhittin (1 commits)")[![vinicius73](https://avatars.githubusercontent.com/u/1561347?v=4)](https://github.com/vinicius73 "vinicius73 (1 commits)")[![dakira](https://avatars.githubusercontent.com/u/576555?v=4)](https://github.com/dakira "dakira (1 commits)")[![febalist](https://avatars.githubusercontent.com/u/6138132?v=4)](https://github.com/febalist "febalist (1 commits)")[![ifaniqbal](https://avatars.githubusercontent.com/u/2200129?v=4)](https://github.com/ifaniqbal "ifaniqbal (1 commits)")[![jekjek](https://avatars.githubusercontent.com/u/6728500?v=4)](https://github.com/jekjek "jekjek (1 commits)")[![JungleGenius](https://avatars.githubusercontent.com/u/11284739?v=4)](https://github.com/JungleGenius "JungleGenius (1 commits)")[![k1ng440](https://avatars.githubusercontent.com/u/3443226?v=4)](https://github.com/k1ng440 "k1ng440 (1 commits)")

---

Tags

laravelbootstrapform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mitris-bootstrap-form/health.svg)

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

###  Alternatives

[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravie/html

HTML and Form Builders for the Laravel Framework

36184.6k4](/packages/laravie-html)[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.

252.7k](/packages/cornford-bootstrapper)[realripley00/bootstrap-4-form

Laravel 5 form wrappers for Bootstrap 4.

1615.8k](/packages/realripley00-bootstrap-4-form)

PHPackages © 2026

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