PHPackages                             jeylabs/larastrap - 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. jeylabs/larastrap

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

jeylabs/larastrap
=================

Laravel 5 form wrappers for Bootstrap 3.

v1.0.1(10y ago)22611MITPHPPHP &gt;=5.4.0

Since Jun 1Pushed 10y agoCompare

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

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

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

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

[![Total Downloads](https://camo.githubusercontent.com/0dedf90f699b6cad7ac262754fdb1036a0d780a0e1ae9d9a297ed6270a8010da/68747470733a2f2f706f7365722e707567782e6f72672f6a65796c6162732f626f6f7473747261702d666f726d2f646f776e6c6f6164732e737667)](https://packagist.org/packages/jeylabs/bootstrap-form)[![Latest Stable Version](https://camo.githubusercontent.com/8998ab22b128db3c41abf246a91d07dd8776a20b0031c1232a60f0aa11d362df/68747470733a2f2f706f7365722e707567782e6f72672f6a65796c6162732f626f6f7473747261702d666f726d2f762f737461626c652e737667)](https://packagist.org/packages/jeylabs/bootstrap-form)[![Latest Unstable Version](https://camo.githubusercontent.com/a7a02991ce983815a3bb67ac2cdf9cd26ea7e7ef2c447d8c2b727365c97bea70/68747470733a2f2f706f7365722e707567782e6f72672f6a65796c6162732f626f6f7473747261702d666f726d2f762f756e737461626c652e737667)](https://packagist.org/packages/jeylabs/bootstrap-form)[![License](https://camo.githubusercontent.com/0a156e06d1e3f738ce256900a4dd65f0ca534bed39b9fcfbe2553eb491d6273f/68747470733a2f2f706f7365722e707567782e6f72672f6a65796c6162732f626f6f7473747261702d666f726d2f6c6963656e73652e737667)](https://packagist.org/packages/jeylabs/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.

```
BootstrapForm::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)

Simply pop this in your `composer.json` file and run `composer update` (however your Composer is installed).

```
"jeylabs/bootstrap-form": "dev-master"

```

Now, add these service providers to your `app/config/app.php` file.

```
'Collective\Html\HtmlServiceProvider',
'Jeylabs\BootstrapForm\BootstrapFormServiceProvider',

```

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

```
'Form'=> 'Collective\Html\FormFacade',
'HTML'=> 'Collective\Html\HtmlFacade',
'BootstrapForm' => 'Jeylabs\BootstrapForm\Facades\BootstrapForm',

```

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)

BoostrapForm 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
BootstrapForm::open(['model' => $user, 'store' => 'users.store', 'update' => 'users.update']);

// COntroller actions
BootstrapForm::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;

BoostrapForm::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.
BootstrapForm::openVertical();

// Open an inline Bootstrap form.
BootstrapForm::openInline();

// Open a horizontal Bootstrap form.
BootstrapForm::openHorizontal();

```

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.

```
BootstrapForm::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'.
BootstrapForm::text('username');

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

BootstrapForm::textarea('profile');

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

```

### Checkbox and radio button inputs

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

Checkboxes and radio buttons are a little bit different and generate different markup. They support both the horizontal and inline layout of the inputs.

View the method signature for configuration options.

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

// An unchecked, but inline checkbox.
BootstrapForm::checkbox('interests', 'Rails', 'rails', null, true);

```

Same goes for radio inputs.

```
BootstrapForm::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.
BootstrapForm::checkboxes('interests', $label, $interests, ['laravel', 'rails']);

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

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

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

```

### Submit button

[](#submit-button)

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

```

### Closing the form

[](#closing-the-form)

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

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

4004d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ed0d4b2d9847ab8f33bfaa6f10e26f331104554bd9ede60a59d12ebc7cca873?d=identicon)[jeylabs](/maintainers/jeylabs)

---

Tags

laravelbootstrapform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jeylabs-larastrap/health.svg)

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

###  Alternatives

[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)[patricktalmadge/bootstrapper

Twitter Bootstrap markup generator

557407.2k4](/packages/patricktalmadge-bootstrapper)[nwidart/laravel-menus

Laravel Menu management

168180.3k10](/packages/nwidart-laravel-menus)[bgaze/bootstrap-form

Bootstrap 4 forms builder for Laravel 5.8+

5243.5k](/packages/bgaze-bootstrap-form)[inkvizytor/fluentform

Form builder for Laravel

3416.2k](/packages/inkvizytor-fluentform)

PHPackages © 2026

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