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

ActiveLibrary

realripley00/bootstrap-4-form
=============================

Laravel 5 form wrappers for Bootstrap 4.

1.1.29(7y ago)1615.8k↓100%12[2 PRs](https://github.com/realripley00/bootstrap-form/pulls)MITPHPPHP &gt;=5.4.0

Since Jun 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/realripley00/bootstrap-form)[ Packagist](https://packagist.org/packages/realripley00/bootstrap-4-form)[ RSS](/packages/realripley00-bootstrap-4-form/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (70)Used By (0)

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

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

This is a fork of Dwight Watson's Bootstrap 3 Form Builder updated/re-styled to use Bootstrap 4 classes, etc. in Laravel 5 applications. It extends the Laravel Collective form builder to provide you with horizontal form groups completed with labels, error messages and appropriate class usage.

[![Total Downloads](https://camo.githubusercontent.com/8da7964db663420b04d4069e7b2c4e7fdcf30af9839e226338d0b5e3bce46602/68747470733a2f2f706f7365722e707567782e6f72672f7265616c7269706c657930302f626f6f7473747261702d342d666f726d2f646f776e6c6f616473)](https://packagist.org/packages/realripley00/bootstrap-4-form)[![Monthly Downloads](https://camo.githubusercontent.com/c427b76140eebea4cefeee00f081a6d2eb926d28a12c7c2aa9a17584affc09f1/68747470733a2f2f706f7365722e707567782e6f72672f7265616c7269706c657930302f626f6f7473747261702d342d666f726d2f642f6d6f6e74686c79)](https://packagist.org/packages/realripley00/bootstrap-4-form)[![License](https://camo.githubusercontent.com/fb71a8b668917a3d1a73a3dc163c276bddfbb197b52a652f52a7ff8f88eadae6/68747470733a2f2f706f7365722e707567782e6f72672f7265616c7269706c657930302f626f6f7473747261702d342d666f726d2f6c6963656e7365)](https://packagist.org/packages/realripley00/bootstrap-4-form)

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

[](#introduction)

Simply use the `BootstrapForm` facade in the place of the `Form` facade when you want to generate a Bootstrap 4 form group. If you use the alias below, it would look like this: BootForm::open(), etc.

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

```

If you're familiar with Dwight Watson's Bootstrap 3 form package, this is basically the same thing but for Bootstrap 4 forms.

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

[](#installation)

First, require the package using Composer.

```
composer require realripley00/bootstrap-4-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,
RealRipley\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' => RealRipley\BootstrapForm\Facades\BootstrapForm::class,
```

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
```

Then just arrow down to this package.

### 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_class' => '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 (TODO) 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);
```

Radio buttons aren't working just yet... Should be updating soon.

```
//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',
    'react'   => 'React',
    'vue'     => 'Vue'
];

// 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();
```

### Labels

[](#labels)

#### Hide Labels

[](#hide-labels)

You may hide an element's label by setting the the value to `false`.

```
// An input with no label.
BootForm::text('username', false);
```

#### Labels with HTML

[](#labels-with-html)

To include HTML code inside a label:

```
// A label with HTML code using array notation
BootForm::text('username', ['html' => 'Username *']);

// A label with HTML code using HtmlString object
BootForm::text('username', new Illuminate\Support\HtmlString('Username *'));
```

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

### Form input group (suffix and prefix)

[](#form-input-group-suffix-and-prefix)

Add prefix and/or suffix to any input - you can add text, icon and buttons.

```
// Suffix button with 'Call' as label and success class to button
{!! BootForm::text('tel', 'Phone', null, ['suffix' => BootForm::addonButton('Call', ['class' => 'btn-success'])] ) !!}

// Prefix button with 'Call' as label and success class to button
{!! BootForm::text('tel', 'Phone', null, ['prefix' => BootForm::addonButton('Call', ['class' => 'btn-success'])] ) !!}

// Prefix icon (I put second parameter after ) with 'dollar' as icon
{!! BootForm::text('tel', 'Phone', null, ['prefix' => BootForm::addonIcon('dollar')] ) !!}

// Prefix and suffix as text
{!! BootForm::text('tel', 'Phone', null, ['prefix' => BootForm::addonText('1-'), 'suffix' => BootForm::addonIcon('phone')] ) !!}

// Prefix and suffix with button
{!! BootForm::text('tel', 'Phone', null, ['suffix' => BootForm::addonButton('Boom!', ['class' => 'btn-danger']), 'prefix' => BootForm::addonButton('Call', ['class' => 'btn-success'])] ) !!}
```

### Dwight Watson's original Bootstrap 3 Form Builder

[](#dwight-watsons-original-bootstrap-3-form-builder)

This is a fork of this awesome package, tweaked a bit to use Bootstrap 4.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 55.9% 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 ~24 days

Recently: every ~64 days

Total

67

Last Release

2667d 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/d6ae3fd28bfd71599918cc16ee0bdb79039bc2419e12da760ff6a6cb3c1af24a?d=identicon)[realripley00](/maintainers/realripley00)

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (119 commits)")[![realripley00](https://avatars.githubusercontent.com/u/23426271?v=4)](https://github.com/realripley00 "realripley00 (25 commits)")[![SystemF](https://avatars.githubusercontent.com/u/6906350?v=4)](https://github.com/SystemF "SystemF (11 commits)")[![rikh42](https://avatars.githubusercontent.com/u/715133?v=4)](https://github.com/rikh42 "rikh42 (11 commits)")[![martynling](https://avatars.githubusercontent.com/u/2652603?v=4)](https://github.com/martynling "martynling (8 commits)")[![DODMax](https://avatars.githubusercontent.com/u/1137276?v=4)](https://github.com/DODMax "DODMax (5 commits)")[![jgrossi](https://avatars.githubusercontent.com/u/1175275?v=4)](https://github.com/jgrossi "jgrossi (4 commits)")[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (3 commits)")[![dansleboby](https://avatars.githubusercontent.com/u/4716382?v=4)](https://github.com/dansleboby "dansleboby (3 commits)")[![aeons](https://avatars.githubusercontent.com/u/1432894?v=4)](https://github.com/aeons "aeons (2 commits)")[![hodaEdrob](https://avatars.githubusercontent.com/u/24437116?v=4)](https://github.com/hodaEdrob "hodaEdrob (2 commits)")[![m3di](https://avatars.githubusercontent.com/u/14237264?v=4)](https://github.com/m3di "m3di (2 commits)")[![madbob](https://avatars.githubusercontent.com/u/166089?v=4)](https://github.com/madbob "madbob (1 commits)")[![MichaelHoughton](https://avatars.githubusercontent.com/u/5341149?v=4)](https://github.com/MichaelHoughton "MichaelHoughton (1 commits)")[![rkrater](https://avatars.githubusercontent.com/u/1753094?v=4)](https://github.com/rkrater "rkrater (1 commits)")[![RobHawk90](https://avatars.githubusercontent.com/u/5470472?v=4)](https://github.com/RobHawk90 "RobHawk90 (1 commits)")[![tmaly1980](https://avatars.githubusercontent.com/u/7697371?v=4)](https://github.com/tmaly1980 "tmaly1980 (1 commits)")[![vedmant](https://avatars.githubusercontent.com/u/5052406?v=4)](https://github.com/vedmant "vedmant (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)")

---

Tags

bootstrap4laravellaravelbootstrapform

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[patricktalmadge/bootstrapper

Twitter Bootstrap markup generator

557401.3k4](/packages/patricktalmadge-bootstrapper)[inkvizytor/fluentform

Form builder for Laravel

3316.1k](/packages/inkvizytor-fluentform)[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)

PHPackages © 2026

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