Quickstart
Build your first Polyform form in minutes
This guide walks you through creating a form end-to-end: adding the trait to your model, defining fields with the fluent API, rendering with Vue and handling submissions.
Step 1: Add the HasPolyforms Trait
Add the HasPolyforms trait to any model you want to attach forms to. This sets up a polymorphic relationship between your model and Polyform's forms:
The trait gives you two methods:
polyforms()- Get all forms attached to this modelpolyform($slug)- Get a specific form by slug
Step 2: Build Your Form
Use the fluent FormBuilder to define your form. It has chainable methods for all 27+ field types:
addText(), addEmail(), addSelect()). Chain validation methods like required(), minLength(), etc. Multi-Step Forms
For multi-step forms, call addStep() before adding the fields for that step:
Step 3: Render the Form
Pass the form data to your Vue component via Inertia:
Then use PolyformRenderer to display it:
PolyformRenderer accepts a form prop and emits a submit event with the validated form data. Step 4: Handle Submissions
Create a controller action that processes submissions using the StoreFormSubmission action:
And register the routes:
Accessing Submission Data
Here's how to retrieve and work with submitted data:
Each submission has a fields relationship with all submitted values. Grab individual values with $submission->getFieldValue('field_key').
Optional: Set Up Webhooks
Want real-time notifications when forms are submitted? Set up a webhook:
Webhooks are dispatched asynchronously via queued jobs with HMAC signature verification. Set the signing secret in your .env file.
Next Steps
You've got a working form. Here's what to dig into next:
Field Types
All 27+ field types, including matrix fields, repeaters, signatures and more.
Conditional Logic
Show or hide fields based on other field values using condition rules.
Dynamic Options
Pull select/radio options from enums, Eloquent models or custom resolvers with search and pagination.
Form Builder UI
Drop in the visual drag-and-drop builder so users can create forms without code.