PHPackages                             mediactive-digital/laravel-bootstrap-4-forms - 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. mediactive-digital/laravel-bootstrap-4-forms

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

mediactive-digital/laravel-bootstrap-4-forms
============================================

Bootstrap 4 form builder for Laravel 5

2.1.1(7y ago)11.2kMITPHP

Since Feb 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mediactive-digital/laravel-bootstrap-4-forms)[ Packagist](https://packagist.org/packages/mediactive-digital/laravel-bootstrap-4-forms)[ RSS](/packages/mediactive-digital-laravel-bootstrap-4-forms/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)DependenciesVersions (18)Used By (0)

Bootstrap 4 forms for Laravel 5
===============================

[](#bootstrap-4-forms-for-laravel-5)

This is a package for creating Bootstrap 4 styled form elements in Laravel 5.

Features
--------

[](#features)

- Labels
- Error messages
- Bootstrap 4 markup and classes (including state, colors, and sizes)
- Error validation messages
- Form fill (using Model instance, array or after form submission when a validation error occurs)
- Internationalization
- Add parameters using php chaining approach
- Zero dependences (no Laravel Collective dependency)

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

[](#introduction)

### Before

[](#before)

```

    Username

    @if($errors->has('username'))

        {{$errors->first('username')}}

    @endif

```

### After

[](#after)

```
Form::text('username', 'Username')
```

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

[](#installation)

#### Require the package using Composer.

[](#require-the-package-using-composer)

```
composer require mediactive-digital/laravel-bootstrap-4-forms
```

### Laravel 5.5 or above

[](#laravel-55-or-above)

If you is using Laravel 5.5, the auto discovery feature will make everything for you and your job is done, you can start using now. Else, follow the steps below to install.

### Laravel 5.4

[](#laravel-54)

#### Add the service provider to your config/app.php file

[](#add-the-service-provider-to-your-configappphp-file)

```
'providers' => [
    //...
	NetoJose\Bootstrap4Forms\Bootstrap4FormsServiceProvider::class,
],
```

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

[](#add-the-bootform-facade-to-the-aliases-array-in-configappphp)

```
'aliases' => [
    //...
    'Form' => NetoJose\Bootstrap4Forms\Bootstrap4FormsFacade::class,
],
```

Usage
-----

[](#usage)

### Basic form controls

[](#basic-form-controls)

#### Opening and closing a form

[](#opening-and-closing-a-form)

```
// Opening a form using POST method
{!!Form::open()!!}

// Opening a form using POST method with specific errors message bag
{!!Form::open('messageBag')!!}

// ... Form components here

// Closing a form
{!!Form::close()!!}
```

> Opening the form will add \_token field automatically for you

#### Inline form

[](#inline-form)

```
// Making all inputs inline
{!!Form::inlineForm()!!}
```

#### Fieldset

[](#fieldset)

ParamTypeDefaultDescription$legendstringnullFieldset Legend$namestringnullFieldset Error$wrapboolfalseFieldset Wrap```
// Examples

// Open fieldset
{!!Form::fieldsetOpen()!!}

// Open fieldset with legend
{!!Form::fieldsetOpen('Legend title')!!}

// Open fieldset with error display by field name
{!!Form::fieldsetOpen('Legend title', 'field_name')!!}

// Open fieldset as wrapper (checkbox/radio)
{!!Form::fieldsetOpen('Legend title', 'field_name', true)!!}

// Open fieldset with help text
{!!Form::fieldsetOpen('Legend title')->help('Help')!!}

// Open fieldset with error display by field name and help text
{!!Form::fieldsetOpen('Legend title', 'field_name')->help('Help')!!}

// ... Fieldset content

// Close fieldset
{!!Form::fieldsetClose()!!}

// Close fieldset with error display by field name
{!!Form::fieldsetClose('field_name')!!}

// Close fieldset with help text
{!!Form::fieldsetClose()->help('Help')!!}

// Close fieldset with error display by field name and help text
{!!Form::fieldsetClose('field_name')->help('Help')!!}
```

### Basic inputs

[](#basic-inputs)

#### Text inputs

[](#text-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::text('name', 'User name')!!}
```

##### Textarea

[](#textarea)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::textarea('description', 'Description')!!}
```

##### Select

[](#select)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$optionsarray\[\]Select options$defaultstringnullDefault value```
// Example
{!!Form::select('city', 'Choose your city', [1 => 'Gotham City', 2 => 'Springfield'])!!}
```

##### Checkbox

[](#checkbox)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$valuestringnullInput value$defaultbooleannullDefault value```
// Example
{!!Form::checkbox('orange', 'Orange')!!}
```

##### Radio

[](#radio)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$valuestringnullInput value$defaultbooleannullDefault value```
// Example
{!!Form::radio('orange', 'Orange')!!}
```

#### File inputs

[](#file-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label```
// Example
{!!Form::file('name', 'File name')!!}
```

#### Plain text inputs

[](#plain-text-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::plainText('name', 'User name')!!}
```

#### Range inputs

[](#range-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::range('name', 'Range')!!}
```

#### Password inputs

[](#password-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::password('name', 'Password')!!}
```

#### Email inputs

[](#email-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::email('name', 'Email')!!}
```

#### Number inputs

[](#number-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::email('name', 'Number')!!}
```

#### Tel inputs

[](#tel-inputs)

ParamTypeDefaultDescription$namestringnullInput name$labelstringnullInput label$defaultstringnullDefault value```
// Example
{!!Form::email('name', 'Tel')!!}
```

##### Hidden

[](#hidden)

ParamTypeDefaultDescription$namestringnullInput name$defaultbooleannullDefault value```
// Example
{!!Form::hidden('user_id')!!}
```

##### Anchor

[](#anchor)

ParamTypeDefaultDescription$valuestringnullAnchor text$urlstringnullAnchor url```
// Example
{!!Form::anchor("Link via parameter", 'foo/bar')!!}
```

##### Buttons

[](#buttons)

ParamTypeDefaultDescription$valuestringnullButton value$colorstringnullButton color$sizestringnullbutton size###### Submit

[](#submit)

```
// Example
{!!Form::submit("Send form")!!}
```

###### Button

[](#button)

```
// Example
{!!Form::button("Do something", "warning", "lg")!!}
```

###### Reset

[](#reset)

```
// Example
{!!Form::reset("Clear form")!!}
```

### Chainable methods

[](#chainable-methods)

> This package uses [chaining](https://en.wikipedia.org/wiki/Method_chaining) feature, allowing easly pass more parameters.

### Filling a form

[](#filling-a-form)

ParamTypeDefaultDescription$dataobjectarraynull```
// Examples

// With initial data using a Model instance
$user = User::find(1);
{!!Form::open()->fill($user)!!}

// With initial array data
$user = ['name' => 'Jesus', 'age' => 33];
{!!Form::open()->fill($user)!!}
```

### Url

[](#url)

Use in anchors and forms openings

ParamTypeDefaultDescription$urlstringnullUrl```
// Example
{!!Form::anchor("Link via url")->url('foo/bar')!!}
```

### Route

[](#route)

Use in anchors and forms openings

ParamTypeDefaultDescription$routestringnullRoute name```
// Example
{!!Form::anchor("Link via route")->route('home')!!}
```

### Checked

[](#checked)

Set the checkbox/radio checked status

ParamTypeDefaultDescription$checkedbooleantrueChecked status```
// Examples

// Make checkbox checked
{!!Form::checkbox('agree', 'I agree')->checked()!!}

// You can use FALSE to turn off checked status
{!!Form::checkbox('agree', 'I agree')->checked(false)!!}
```

### Inline

[](#inline)

Set the checkbox/radio inline

```
// Examples
{!!Form::radio('orange', 'Orange')->inline()!!}

{!!Form::checkbox('orange', 'Orange')->inline()!!}
```

### Placeholder

[](#placeholder)

ParamTypeDefaultDescription$placeholderstringnullPlaceholder text```
// Example
{!!Form::text('name', 'Name')->placeholder('Input placeholder')!!}
```

### Autocomplete

[](#autocomplete)

ParamTypeDefaultDescription$autocompletebooleantrueAutocomplete status```
// Examples

// Set autocomplete on input
{!!Form::text('name', 'Name')->autocomplete()!!}

// You can use FALSE to turn off autocomplete status
{!!Form::text('name', 'Name')->autocomplete(false)!!}
```

### SrOnly

[](#sronly)

Set the label sr-only status

ParamTypeDefaultDescription$srOnlybooleantrueSrOnly status```
// Examples

// Set sr-only style on label
{!!Form::text('name', 'Name')->srOnly()!!}

// You can use FALSE to turn off sr-only status
{!!Form::text('name', 'Name')->srOnly(false)!!}
```

### Prepend

[](#prepend)

Prepend content to input

ParamTypeDefaultDescription$prependstringnullInput prepend```
// Example
{!!Form::text('name', 'Name')->prepend('Input prepend')!!}
```

### Select Multiple

[](#select-multiple)

```
// Example
{!!Form::select('city', 'Choose your city', [1 => 'Gotham City', 2 => 'Springfield'])->multiple()!!}
```

### Locale

[](#locale)

Using locale, the package will look for a resources/lang/{CURRENT\_LANG}/forms/user.php language file and uses labels and help texts as keys for replace texts

```
// Example
{!!Form::open()->locale('forms.user')!!}
```

### Help Text

[](#help-text)

ParamTypeDefaultDescription$textstringnullHelp text```
// Example
{!!Form::text('name', 'Name')->help('Help text here')!!}
```

### Custom attributes

[](#custom-attributes)

ParamTypeDefaultDescription$attrsarray\[\]Custom input attributes```
// Example
{!!Form::text('name', 'Name')->attrs(['data-foo' => 'bar', 'rel'=> 'baz'])!!}
```

### Readonly

[](#readonly)

ParamTypeDefaultDescription$statusbooleantrueRead only status```
// Examples

// Using readonly field
{!!Form::text('name', 'Name')->readonly()!!}

// You can use FALSE to turn off readonly status
{!!Form::text('name', 'Name')->readonly(false)!!}
```

### Disabled

[](#disabled)

ParamTypeDefaultDescription$statusbooleantrueDisabled status```
// Examples

// Disabling a field
{!!Form::text('name', 'Name')->disabled()!!}

// Disabling a fieldset
{!!Form::fieldsetOpen('User data')->disabled()!!}

// You can use FALSE to turn off disabled status
{!!Form::text('name', 'Name')->disabled(false)!!}
```

### Required

[](#required)

ParamTypeDefaultDescription$statusbooleantrueRequired status```
// Examples

// Make a field required
{!!Form::text('name', 'Name')->required()!!}

 // Make a fieldset required
{!!Form::fieldsetOpen('User data')->required()!!}

 // You can use FALSE to turn off required status
{!!Form::text('name', 'Name')->required(false)!!}
```

### Block

[](#block)

ParamTypeDefaultDescription$statusbooleantrueDisabled status```
// Examples

// Set block style on a field
{!!Form::text('name', 'Name')->block()!!}

// You can use FALSE to turn off block status
{!!Form::text('name', 'Name')->block(false)!!}
```

### Simple

[](#simple)

ParamTypeDefaultDescription$simplebooleantrueSimple status```
// Examples

// Set simple status for a button
{!!Form::button('Button')->simple()!!}

// Set simple status for an anchor
{!!Form::anchor('Anchor')->simple()!!}

// You can use FALSE to turn off simple status
{!!Form::button('Button')->simple(false)!!}
```

### Id

[](#id)

ParamTypeDefaultDescription$idstringnullField id```
// Example
{!!Form::text('name', 'Name')->id('user-name')!!}
```

### Class

[](#class)

ParamTypeDefaultDescription$classstringnullField class```
// Example
{!!Form::text('name', 'Name')->class('class')!!}
```

### Wrapper class

[](#wrapper-class)

ParamTypeDefaultDescription$classstringnullWrapper class```
// Example
{!!Form::text('name', 'Name')->wrapperClass('class')!!}
```

### Label class

[](#label-class)

ParamTypeDefaultDescription$classstringnullLabel class```
// Example
{!!Form::text('name', 'Name')->labelClass('class')!!}
```

### Id prefix

[](#id-prefix)

ParamTypeDefaultDescription$prefixstringnullId prefix```
// Example
{!!Form::open()->idPrefix('register')!!}
```

### General class

[](#general-class)

ParamTypeDefaultDescription$classstringnullGeneral class```
// Example
{!!Form::open()->generalClass('class')!!}
```

### Multipart

[](#multipart)

ParamTypeDefaultDescription$multipartbooleantrueMultipart flag```
// Examples
{!!Form::open()->multipart()!!}

// You can use FALSE to turn off multipart
{!!Form::open()->multipart(false)!!}
```

### Method

[](#method)

ParamTypeDefaultDescription$methodstringnullHTTP method```
// Examples
{!!Form::open()->method('get')!!}
{!!Form::open()->method('post')!!}
{!!Form::open()->method('put')!!}
{!!Form::open()->method('patch')!!}
{!!Form::open()->method('delete')!!}
```

### explicit HTTP verbs

[](#explicit-http-verbs)

```
// Examples
{!!Form::open()->get()!!}
{!!Form::open()->post()!!}
{!!Form::open()->put()!!}
{!!Form::open()->patch()!!}
{!!Form::open()->delete()!!}
```

### Color

[](#color)

ParamTypeDefaultDescription$colorstringnullColor name```
// Examples
{!!Form::button("Do something")->color("warning")!!}

{!!Form::button("Do something")->color("primary")!!}
```

### explicit color

[](#explicit-color)

```
// Examples
{!!Form::button("Button label")->warning()!!}
{!!Form::button("Button label")->outline()!!}
{!!Form::button("Button label")->success()!!
{!!Form::button("Button label")->danger()!!}
{!!Form::button("Button label")->secondary()!!}
{!!Form::button("Button label")->info()!!}
{!!Form::button("Button label")->light()!!}
{!!Form::button("Button label")->dark()!!}
{!!Form::button("Button label")->link()!!}
```

### Size

[](#size)

ParamTypeDefaultDescription$sizestringnullSize name```
// Examples
{!!Form::button("Do something")->size("sm")!!}

{!!Form::button("Do something")->size("lg")!!}
```

### Explicit size

[](#explicit-size)

```
// Examples
{!!Form::button("Button label")->sm()!!}
{!!Form::button("Button label")->lg()!!}
```

### Type

[](#type)

ParamTypeDefaultDescription$typestringnullType field```
// Examples

// Password field
{!!Form::text('password', 'Your password')->type('password')!!}

// Number field
{!!Form::text('age', 'Your age')->type('number')!!}

// Email field
{!!Form::text('email', 'Your email')->type('email')!!}
```

### Name

[](#name)

ParamTypeDefaultDescription$namestringnullInput name```
// Examples
{!!Form::text('text')->name('name')!!}
```

### Label

[](#label)

ParamTypeDefaultDescription$labelstringnullInput label```
// Examples
{!!Form::text('age')->label('Your age')!!}
```

### Default Value

[](#default-value)

ParamTypeDefaultDescription$valuemixednullInput value```
// Example
{!!Form::text('name', 'Your name')->value('Maria')!!}
```

### Render

[](#render)

ParamTypeDefaultDescription$renderstringnullRender name```
// Examples

// Number field
{!!Form::render('text')->name('age')->label('Your age')!!}
```

### Chaining properties

[](#chaining-properties)

You can use chaining feature to use a lot of settings for each component

```
// Examples

{!!Form::open()->locale('forms.user')->put()->multipart()->route('user.add')->data($user)!!}

{!!Form::text('name', 'Name')->placeholder('Type your name')->lg()!!}

{!!Form::anchor("Link as a button")->sm()->info()->outline()!!}

{!!Form::submit('Awesome button')->id('my-btn')->disabled()->danger()->lg()!!}

{!!Form::close()!!}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 53.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 ~22 days

Recently: every ~33 days

Total

17

Last Release

2660d ago

Major Versions

1.0.1 → 2.0.02018-06-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40459235?v=4)[Mediactive Digital](/maintainers/mediactive-digital)[@mediactive-digital](https://github.com/mediactive-digital)

---

Top Contributors

[![netojose](https://avatars.githubusercontent.com/u/134008?v=4)](https://github.com/netojose "netojose (41 commits)")[![innovaweb-dev](https://avatars.githubusercontent.com/u/2601347?v=4)](https://github.com/innovaweb-dev "innovaweb-dev (15 commits)")[![joseneto-fixeads](https://avatars.githubusercontent.com/u/31626384?v=4)](https://github.com/joseneto-fixeads "joseneto-fixeads (13 commits)")[![bumerang07](https://avatars.githubusercontent.com/u/4818130?v=4)](https://github.com/bumerang07 "bumerang07 (5 commits)")[![fchalal](https://avatars.githubusercontent.com/u/40465455?v=4)](https://github.com/fchalal "fchalal (1 commits)")[![ilyes-kechidi](https://avatars.githubusercontent.com/u/482942?v=4)](https://github.com/ilyes-kechidi "ilyes-kechidi (1 commits)")

---

Tags

phpcomposerlaravelpackagebootstrapFormsform-builder

### Embed Badge

![Health badge](/badges/mediactive-digital-laravel-bootstrap-4-forms/health.svg)

```
[![Health](https://phpackages.com/badges/mediactive-digital-laravel-bootstrap-4-forms/health.svg)](https://phpackages.com/packages/mediactive-digital-laravel-bootstrap-4-forms)
```

###  Alternatives

[netojose/laravel-bootstrap-4-forms

Bootstrap 4 form builder for Laravel 5

182115.3k](/packages/netojose-laravel-bootstrap-4-forms)[metalogico/laravel-formello

A Laravel package for generating Bootstrap 5 and Tailwind CSS 4 forms based on models

1012.2k](/packages/metalogico-laravel-formello)

PHPackages © 2026

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