bgaze/bootstrap-form

Bootstrap 4 & 5 forms builder for Laravel 12+

Maintainers

Package info

github.com/bgaze/bootstrap-form

pkg:composer/bgaze/bootstrap-form

Transparency log

Statistics

Installs: 54 628

Dependents: 0

Suggesters: 0

Stars: 51

Open Issues: 0

v4.2.0 2026-08-18 07:51 UTC

README

Tests GitHub license Maintenance GitHub release (latest by date) GitHub Repo stars Packagist

Bootstrap 4 & 5 forms builder for Laravel 12+

This package simplifies Bootstrap forms creation in Laravel applications, rendering all markup through its own lightweight HTML/form layer.

It renders Bootstrap 5 markup by default and fully supports Bootstrap 4 for backward compatibility.

Model form binding and automatic error display are supported, as well as most Bootstrap form features: form layouts, custom fields, input groups, and more.

Any contribution or feedback is highly welcomed, please feel free to create a pull request or submit a new issue.

⚠️ v4 has breaking changes

v4 drops the historical laravelcollective/html dependency in favor of an internal, iso-rendering HTML/form layer, and renders Bootstrap 5 by default.

Before upgrading an existing application, read Upgrading from v3.

To keep using a previous major version, require it explicitly and refer to its dedicated branch:

Version Install Docs
v3 (Bootstrap 4 default, B5 opt-in) composer require "bgaze/bootstrap-form:^3.0" v3 branch · archived docs
v2 (Bootstrap 4 only) composer require "bgaze/bootstrap-form:^2.0" v2 branch · archived docs

Documentation

Full documentation and examples are available at https://packages.bgaze.fr/bootstrap-form

If you use PhpStorm IDE, you can also check this gist which allow to easily configure syntax highlighting and live templates for this package's custom Blade directives.

If you build forms with the help of an AI coding assistant, this repository also ships an LLM-optimized usage guide: docs/llm/index.md, indexed by llms.txt.

Quick start

Requirements

  • PHP 8.2+
  • Laravel 12 or 13

Installation

Install the package using Composer:

composer require bgaze/bootstrap-form

Several configuration options are available; publish the configuration file to customize them:

php artisan vendor:publish --provider="Bgaze\BootstrapForm\BootstrapFormServiceProvider"

Usage

Forms can be built through three interchangeable syntaxes that produce byte-identical HTML.

Blade x-components:

<x-bf::form url="/my/url" novalidate>
    <x-bf::text name="login"/>
    <x-bf::email name="email"/>
    <x-bf::checkbox name="remember_me" switch inline/>
    <x-bf::submit>Login</x-bf::submit>
</x-bf::form>

Blade directives:

@open(['url' => '/my/url', 'novalidate' => true])
@text('login')
@email('email')
@checkbox('remember_me', null, 1, null, ['switch' => true, 'inline' => true])
@submit('Login')
@close

The BF facade, in any PHP context:

echo BF::open(['url' => '/my/url', 'novalidate' => true]);
echo BF::text('login');
echo BF::email('email');
echo BF::checkbox('remember_me', null, 1, null, ['switch' => true, 'inline' => true]);
echo BF::submit('Login');
echo BF::close();

License

Open-sourced software licensed under the MIT license.