PHPackages                             talentasia/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. talentasia/bootforms

ActiveLibrary

talentasia/bootforms
====================

Form Builder with some Bootstrap specific conveniences.

0.1(8y ago)054MITPHPPHP &gt;=5.4.0

Since Aug 3Pushed 8y ago1 watchersCompare

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

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

BootForms
=========

[](#bootforms)

- [Installation](#installing-with-composer)
- [Using BootForms](#using-bootforms)
    - [Basic Usage](#basic-usage)
    - [Customizing Elements](#customizing-elements)
    - [Reduced Boilerplate](#reduced-boilerplate)
    - [Automatic Validation State](#automatic-validation-state)
    - [Horizontal Forms](#horizontal-forms)
    - [Additional Tips](#additional-tips)
- [Related Resources](#related-resources)

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

[](#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 talentasia/bootforms
```

### Laravel

[](#laravel)

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

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

```
'providers' => [
    //...
    'TalentAsia\BootForms\BootFormsServiceProvider'
  ],
```

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

```
'aliases' => [
    //...
    'BootForm' => 'TalentAsia\BootForms\Facades\BootForm'
  ],
```

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

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

### Outside of Laravel

[](#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 TalentAsia\Form\FormBuilder;

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

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

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

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

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

[](#using-bootforms)

### Basic Usage

[](#basic-usage)

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

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

> Note: Don't forget to `open()` 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

[](#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 `attribute` method, or by simply using the attribute name as the method name.

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

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

//
BootForm::open()->get()->action('/users');

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

### Reduced Boilerplate

[](#reduced-boilerplate)

Typical Bootstrap form boilerplate might look something like this:

```

    First Name

    Last Name

    Date of Birth

    Email address

    Password

  Submit

```

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

[](#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 with a call to `openHorizontal($columnSizes)` instead:

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

[](#additional-tips)

#### Hiding Labels

[](#hiding-labels)

You can hide labels by chaining the `hideLabel()` 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 `.sr-only` class, so you don't reduce the accessibility of your form.

#### Help Blocks

[](#help-blocks)

You can add a help block underneath a form element using the `helpBlock()` helper.

`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

[](#model-binding)

BootForms makes it easy to bind an object to a form to provide default values.

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

Related Resources
-----------------

[](#related-resources)

- [Laravel Translatable BootForms](https://github.com/Propaganistas/Laravel-Translatable-Bootforms), integrates BootForms with Dimsav's [Laravel Translatable](https://github.com/dimsav/laravel-translatable) package

This package based on

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

3206d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8985ad625fe918e4fdc3cf00c392ea3e8713e4b8160c0507b348c4da7a8b8e4b?d=identicon)[thosuperman](/maintainers/thosuperman)

---

Top Contributors

[![thosuperman](https://avatars.githubusercontent.com/u/17564259?v=4)](https://github.com/thosuperman "thosuperman (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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