anthonyedmonds/laravel-form-builder
A Laravel package for building and rendering HTML forms programmatically, letting you define fields, validation, and layout in PHP instead of hand-writing markup. Useful for keeping form logic reusable and consistent across views.
Install and publish
composer require anthonyedmonds/laravel-form-builder
php artisan vendor:publish --provider="AnthonyEdmonds\LaravelFormBuilder\FormBuilderServiceProvider"
The package follows the standard Laravel package conventions, so the publish step is the important one — check what tags it exposes (--tag=config, --tag=views) and only publish the views if you intend to override them. Current line is 2.6.x; 2.6.2 is a patch on top of 2.6.1, so anything you read for 2.6.x applies.
Where to look first
config/form-builder.php (or similarly named) after publishing — this is where the framework-level defaults live (view namespace, CSS framework / styling assumptions, wrapper markup).src/ root — identify the base form class and the base field/control class. Almost every customisation you'll do in a real project is a subclass of one of those two.resources/views/vendor/... — this is the ground truth for what markup you actually get, and it answers most "why is this rendered like that" questions faster than the docs.First use case
The canonical first use is: define one form class for a real form in your app (e.g. a contact or profile form), declare its fields and validation rules in that class, then render it from a controller-provided instance in a Blade view. Resist building a generic form abstraction on day one — create a single concrete form, render it, submit it, and confirm the old-input/error repopulation behaviour works. That end-to-end loop exercises the parts of the package most likely to surprise you.
Form-as-a-class
The core pattern is a PHP class per form, holding field definitions and validation rules together. This is the main value over hand-written Blade: rules, labels, and input types live in one place, so a field rename is a single edit rather than a grep across views and request classes. Keep these classes thin — field definitions and rules only. Business logic belongs in an action or service, not in the form class.
Validation
Prefer letting the form class own its rules and wiring that into a FormRequest or a controller validate() call, rather than duplicating rules in two places. Where the package derives rules from field definitions, use that direction (fields → rules) instead of the reverse, so adding a field cannot silently skip validation.
Rendering and overrides
Render via the package's Blade components/directives in your views rather than reaching into field objects manually. When the default markup doesn't match your design system, override the individual view rather than editing vendor files, and keep those overrides in version control with a comment naming the package version they were copied from. Overrides are the most common source of breakage on minor upgrades (see below).
Composition
For larger forms, group fields into sections/fieldsets and build the form from those groups. This keeps individual classes readable and lets you reuse a field group (address block, contact details) across multiple forms. If the package supports partials or sub-forms, prefer those over copy-pasting field definitions.
Integration tips
2.6.2 specifically
^2.6 and let it in.Debugging
name matches the request key exactly — this is the single most common cause.web group will appear broken.Config quirks
Extension points
Upgrade discipline
How can I help you explore Laravel packages today?