Search by

roundly-consulting / forms-for-laravel

mihaliak

Manage form structures, fields, and submissions in the database.

Package info

github.com/roundly-consulting/forms-for-laravel

pkg:composer/roundly-consulting/forms-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:40 UTC

This package is auto-updated.

Last update: 2026-10-03 18:54:07 UTC


README

Forms for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Forms for Laravel

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.

Installation

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.

Usage

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' => 'jane@example.com', 'body' => 'Hello!']

Documentation

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.

Support our work

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.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see LICENSE for more information.