bgaze / bootstrap-form
Bootstrap 4 & 5 forms builder for Laravel 12+
Requires
- php: ^8.2
- illuminate/database: ^12.0 || ^13.0
- illuminate/http: ^12.0 || ^13.0
- illuminate/routing: ^12.0 || ^13.0
- illuminate/session: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
- illuminate/view: ^12.0 || ^13.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0 || ^11.0
- phpunit/phpunit: ^11.0
README
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 status — functional, documentation in progress
v4 is functional and tested, but its full documentation is still being written.
In the meantime, the LLM usage guide shipped in this repository is the authoritative, up-to-date reference (dense but exact — usable by humans and AI assistants alike).
The full documentation site still reflects v3 and will be regenerated for v4.
⚠️ Upgrading — v4 has breaking changes
v4 introduces breaking changes over v3 (see What's new below).
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 · site |
| v2 (Bootstrap 4 only) | composer require "bgaze/bootstrap-form:^2.0" |
v2 branch · site |
What's new in v4
- No more third-party dependency
The historicallaravelcollective/htmldependency is gone, replaced by an internal, iso-rendering HTML/form layer owned by the package. - Bootstrap 5 is now the default
Bootstrap 4 remains fully supported for backward compatibility (frozen), switchable viabootstrap_versionglobally, per form (BF::open(['bootstrap_version' => 4])), or per field. - Laravel 12 & 13, PHP 8.2+
Older versions dropped. - x-components
A new Blade component syntax (<x-bf::text .../>) alongside the directives and theBFfacade; all three render identical markup. - Richer choice grammar for select/checkboxes/radios
Optgroups, per-option attributes, accepting anyiterable(array, Collection, generator). - New field types & layouts
datetime-local,month,week,searchinputs, Bootstrap 5 floating labels, opt-in valid feedback, and accessiblearia-describedby/aria-invalidwiring. - LLM-optimized documentation
Seedocs/llm/(+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:
x-components
<x-bf::form url="/x"> <x-bf::text name="field"/> <x-bf::submit>Save</x-bf::submit> </x-bf::form>
Blade directives
@open(['url' => '/x']) @text('field') @submit('Save') @close
BF facade
echo BF::open(['url' => '/x']); echo BF::text('field'); echo BF::submit('Save'); echo BF::close();
License
Open-sourced software licensed under the MIT license.