PHPackages                             typicms/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. typicms/bootforms

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

typicms/bootforms
=================

Just a Formbuilder with some Bootstrap 5 specific conveniences. Remembers old input, retrieves error messages and handles all your boilerplate Bootstrap markup automatically.

5.0.0(1mo ago)1256.0k↑26.3%8[1 PRs](https://github.com/typicms/bootforms/pulls)1MITPHPPHP ^8.2CI passing

Since May 9Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/typicms/bootforms)[ Packagist](https://packagist.org/packages/typicms/bootforms)[ GitHub Sponsors](https://github.com/typicms)[ RSS](/packages/typicms-bootforms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (14)Used By (1)

BootForms
=========

[](#bootforms)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7899e9617242d5e414a3a1e9699f288333b58a524141b8bd503acb660ec69f38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74797069636d732f626f6f74666f726d732e737667)](https://packagist.org/packages/typicms/bootforms)[![tests](https://github.com/typicms/bootforms/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/typicms/bootforms/actions/workflows/tests.yml)[![Rector](https://github.com/typicms/bootforms/actions/workflows/rector.yml/badge.svg?branch=main)](https://github.com/typicms/bootforms/actions/workflows/rector.yml)[![Pint](https://github.com/typicms/bootforms/actions/workflows/pint.yml/badge.svg?branch=main)](https://github.com/typicms/bootforms/actions/workflows/pint.yml)

BootForms was originally created by [Adam Wathan](https://github.com/adamwathan). It is build on top of the more general [Form](https://github.com/adamwathan/form) package by adding another layer of abstraction to rapidly generate markup for standard Bootstrap 5 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!

- [Installation](#installing-with-composer)
- [Using BootForms](#using-bootforms)
    - [Basic Usage](#basic-usage)
    - [Customizing Elements](#customizing-elements)
    - [Reduced Boilerplate](#reduced-boilerplate)
    - [Input Groups](#input-groups)
    - [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 typicms/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' => [
    //...
    'TypiCMS\BootForms\BootFormsServiceProvider'
  ],
```

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

```
'aliases' => [
    //...
    'BootForm' => 'TypiCMS\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 TypiCMS\Form\FormBuilder;

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

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

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

> Note: You must provide your own implementations of `TypiCMS\Form\OldInputInterface` and `TypiCMS\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');
```

For more information about what’s possible, check out the documentation for [the Form package.](https://github.com/TypiCMS/form)

### 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() !!}
```

### Input groups

[](#input-groups)

Bootforms allows you to create input groups.

```
//
//      Amount
//
//          $
//
//
//
{!! BootForm::inputGroup('Amount', 'amount')->type('number')->beforeAddon('$') !!}
```

With a button appended.

```
//
//      Email
//
//
//          OK
//
//
{!! BootForm::inputGroup('Email', 'email')->afterAddon(BootForm::submit('OK')) !!}
```

### 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 `is-invalid` 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 `.visually-hidden` class, so you don’t reduce the accessibility of your form.

#### Form Text

[](#form-text)

You can add a text block underneath a form element using the `formText()` helper.

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

#### Model Binding

[](#model-binding)

BootForms makes it easy to bind an object to a form to provide default values. Read more about it [here](https://github.com/adamwathan/form#model-binding).

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

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~475 days

Total

10

Last Release

56d ago

Major Versions

1.0.3 → 2.0.02020-09-21

2.0.0 → 3.0.02021-01-06

3.0.1 → 4.0.02022-04-26

4.0.1 → 5.0.02026-03-23

PHP version history (3 changes)1.0.0PHP &gt;=5.5.0

4.0.0PHP ^8.0.2

5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/b93740e4c6b40a6219441696db5db9c4b635dad91339c1893dfe0813434e8d94?d=identicon)[Samuel De Backer](/maintainers/Samuel%20De%20Backer)

---

Top Contributors

[![adamwathan](https://avatars.githubusercontent.com/u/4323180?v=4)](https://github.com/adamwathan "adamwathan (102 commits)")[![sdebacker](https://avatars.githubusercontent.com/u/134503?v=4)](https://github.com/sdebacker "sdebacker (92 commits)")[![jesseleite](https://avatars.githubusercontent.com/u/5187394?v=4)](https://github.com/jesseleite "jesseleite (11 commits)")[![moura137](https://avatars.githubusercontent.com/u/1171111?v=4)](https://github.com/moura137 "moura137 (4 commits)")[![nthndnn](https://avatars.githubusercontent.com/u/1976300?v=4)](https://github.com/nthndnn "nthndnn (3 commits)")[![robbiepaul](https://avatars.githubusercontent.com/u/2804149?v=4)](https://github.com/robbiepaul "robbiepaul (2 commits)")[![AydinHassan](https://avatars.githubusercontent.com/u/2817002?v=4)](https://github.com/AydinHassan "AydinHassan (2 commits)")[![Propaganistas](https://avatars.githubusercontent.com/u/6680176?v=4)](https://github.com/Propaganistas "Propaganistas (2 commits)")[![clemblanco](https://avatars.githubusercontent.com/u/668419?v=4)](https://github.com/clemblanco "clemblanco (1 commits)")[![nathanleclaire](https://avatars.githubusercontent.com/u/1476820?v=4)](https://github.com/nathanleclaire "nathanleclaire (1 commits)")[![Sobak](https://avatars.githubusercontent.com/u/1347533?v=4)](https://github.com/Sobak "Sobak (1 commits)")[![django23](https://avatars.githubusercontent.com/u/827397?v=4)](https://github.com/django23 "django23 (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")[![JavierMartinz](https://avatars.githubusercontent.com/u/1155507?v=4)](https://github.com/JavierMartinz "JavierMartinz (1 commits)")[![cpgo](https://avatars.githubusercontent.com/u/739891?v=4)](https://github.com/cpgo "cpgo (1 commits)")[![manavo](https://avatars.githubusercontent.com/u/259487?v=4)](https://github.com/manavo "manavo (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[coderello/laravel-populated-factory

An easy way to generate populated factories.

24523.0k](/packages/coderello-laravel-populated-factory)[fortawesome/wordpress-fontawesome

Official Font Awesome WordPress plugin composer package.

662.1k](/packages/fortawesome-wordpress-fontawesome)

PHPackages © 2026

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