Manage form structures, fields, and submissions in the database.
roundly-consulting/forms-for-laravel is a Laravel package for manage form structures, fields, and submissions in the database..
It currently has 5 GitHub stars and 8 downloads on Packagist (latest version 1.0.4).
Install it with composer require roundly-consulting/forms-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
Define multi-step forms — groups and fields — in your database, validate user input against per-field rules, and store submissions you can read back as typed answers. Everything is driven by Eloquent models you can swap for your own.
Requires PHP 8.4, Laravel 12 or 13.
composer require roundly-consulting/forms-for-laravel
php artisan vendor:publish --tag="forms-migrations"
php artisan vendor:publish --tag="approvals-migrations" --tag="attributes-migrations" --tag="media-migrations"
php artisan migrate
The migrations are not loaded automatically, and the companion packages' migrations are needed
too. If your senders have UUID/ULID keys, set FORMS_KEY_TYPE before migrating.
Define a form once, with its groups (steps) and fields:
use RoundlyConsulting\Forms\Facades\Forms;
use RoundlyConsulting\Forms\GroupBuilder;
Forms::define('contact', 'Contact us')
->public()
->group('details', 'Your details', function (GroupBuilder $g): void {
$g->field('name', 'Name')->rules(['required', 'string']);
$g->field('email', 'Email')->email()->required();
})
->group('message', 'Message', function (GroupBuilder $g): void {
$g->field('body', 'Message')->textarea()->required();
})
->create();
Validate and store a submission — input arrives keyed by form.group.field
(contact.details.name):
$form = Forms::find('contact');
Forms::validate(form: $form, request: $request); // throws ValidationException on failure
$result = Forms::submit(form: $form, request: $request, sender: $request->user());
$result->uuid; // the submission's reference id
Read the answers back, one keyed set per submission:
$answers = Forms::submissions($form)->latest()->get();
$answers->first()->values; // ['name' => 'Jane', 'email' => '[email protected]', 'body' => 'Hello!']
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/forms-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
The MIT License (MIT). Please see LICENSE for more information.