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

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

llama-laravel/bootstrap-form
============================

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

1128PHP

Since Mar 20Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

BootForms
=========

[](#bootforms)

BootForms builds on top of my more general [Form](https://github.com/LaravelCollective/html) package by adding another layer of abstraction to rapidly generate markup for standard Bootstrap3 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)
- [Feature Overview](#feature-overview)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Extending](#extending)
- [Plugins and Supported Rules](#plugins-and-supported-rules)
- [Licence](#licence)

### Feature Overview

[](#feature-overview)

- Multi-Plugin Support *//For now, there is just one :)*
    - `Jquery Validation`
- Extendible
- Laravel form builder based
- Validation rules can be set from controller
- Distinguishing between numeric input and string input
- User friendly input names
- Remote rules such as unique and exists

### Installing

[](#installing)

You can install this package via Composer by running this command in your terminal in the root of your project:

```
composer require llama-laravel/bootstrap-form
```

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

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

```
'providers' => [
    //...
    Llama\BootstrapForm\BootstrapFormServiceProvider::class
  ],
```

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

```
'aliases' => [
    //...
    'Form' => Llama\BootstrapForm\BootstrapFormFacade::class
  ],
```

Also you need to publish configuration file and assets by running the following Artisan commands.

```
$ php artisan vendor:publish --provider="Llama\BootstrapForm\BootstrapFormServiceProvider"
```

You can now start using BootstrapForm follow [here](https://laravelcollective.com/docs/5.3/html).

### Configuration

[](#configuration)

After publishing configuration file, you can find it in config/laravalid folder. Configuration parameters are as below:

ParameterDescriptionValuespluginChoose plugin you want to useSee [Plugins and Supported Rules](#plugins-and-supported-rules)useBuiltinMessageIf it is true, laravel validation messages are used in client side otherwise messages of chosen plugin are usedtrue/falserouteRoute name for remote validationAny route name (default: js-validation-remote)### Usage

[](#usage)

```
    $rules = ['name' => 'required|max:100', 'email' => 'required|email', 'birthdate' => 'date'];
    Form::open(['url' => 'foo/bar', 'method' => 'put', 'rules' => $rules]);
    Form::text('name');
    Form::text('email');
    Form::text('birthdate');
    Form::close(); // don't forget to close form, it reset validation rules
```

Also if you don't want to struggle with $rules at view files, you can set it in Controller or route with or without form name by using Form::setValidation($rules, $formName). If you don't give form name, this sets rules for first Form::open

```
    // in controller or route
    $rules = ['name' => 'required|max:100', 'email' => 'required|email', 'birthdate' => 'date'];
    Form::setValidateRules($rules);

    // in view
    Form::open(['url' => 'foo/bar', 'method' => 'put', 'name' => 'firstForm', 'rules' => $rules]);
    // some form inputs
    Form::close();
```

For rules which is related to input type in laravel (such as max, min), the package looks for other given rules to understand which type is input. If you give integer or numeric as rule with max, min rules, the package assume input is numeric and convert to data-rule-max instead of data-rule-maxlength.

```
    $rules = ['age' => 'numeric|max'];
```

The converter assume input is string by default. File type is not supported yet.

**Validation Messages**

Converter uses validation messages of laravel (app/lang/en/validation.php) by default for client-side too. If you want to use jquery validation messages, you can set useLaravelMessages, false in config file of package which you copied to your config dir.

#### Plugins

[](#plugins)

**Jquery Validation**While using Jquery Validation as html/js validation plugin, you can include any [extension method](https://jqueryvalidation.org/extension-method/) in your views, too. After assets published, it will be copied to your public folder. The last thing you should do at client side is initializing jquery validation plugin as below:

```

$('form').validate({onkeyup: false}); //while using remote validation, remember to set onkeyup false

```

### Extending

[](#extending)

There are two ways to extend package with your own rules. First, you can extend current converter plugin dynamically like below:

```
Form::getConverter()->getRuleTransformer()->extend('someotherrule', function($parsedRule, $attribute, $type){
    // some code
    return ['data-rule-someotherrule' => 'blablabla'];
});
Form::getConverter()->getMessageTransformer()->extend('someotherrule', function($parsedRule, $attribute, $type){
    // some code
    return ['data-message-someotherrule' => 'Some other message'];
});
```

Second, you can create your own converter (which extends baseconverter or any current plugin converter) in `Llama\BootstrapForm\Converter` namespace and change plugin configuration in config file with your own plugin name.

> **Note:** If you are creating a converter for some existed html/js plugin please create it in `converters` folder and send a pull-request.

### Plugins and Supported Rules

[](#plugins-and-supported-rules)

**Jquery Validation**To use Jquery Validation, change plugin to `Llama\BootstrapForm\Converter\JqueryValidation\Converter` in config file.

RulesJquery ValidationAccepted-Active URL-After (Date)-Alpha`+`Alpha Dash-Alpha Numeric-Array-Before (Date)-Between`+`Boolean-Confirmed-Date`+`Date Format-Different-Digits-Digits Between-E-Mail`+`Exists (Database)`+`Image (File)-In-Integer-IP Address`+`Max`+`MIME Types-Min`+`Not In-Numeric`+`Regular Expression`+`Required`+`Required If-Required With-Required With All-Required Without-Required Without All-Same`+`Size-String-Timezone-Unique (Database)`+`URL`+`> **Note:** It is easy to add some rules. Please check `Rule` class of related converter.

### Contribution

[](#contribution)

You can fork and contribute to development of the package. All pull requests is welcome.

**Convertion Logic**Package converts rules by using converters (in src/converters). It uses Converter class of chosen plugin which extends BaseConverter/Converter class. You can look at existed methods and plugins to understand how it works. Explanation will be ready, soon.

### Additional Tips

[](#additional-tips)

#### Help Blocks

[](#help-blocks)

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

`Form::help('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.

### License

[](#license)

Licensed under the MIT License

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/8601be70d0d3d5a02c55b5aca4b1ee0d762370b77b95bdb8bce9f6a68a7d0827?d=identicon)[xuanhoa88](/maintainers/xuanhoa88)

---

Top Contributors

[![xuanhoa88](https://avatars.githubusercontent.com/u/406820?v=4)](https://github.com/xuanhoa88 "xuanhoa88 (49 commits)")[![xuanntVnext](https://avatars.githubusercontent.com/u/24215488?v=4)](https://github.com/xuanntVnext "xuanntVnext (6 commits)")

### Embed Badge

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

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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