A Filament plugin and package that allows the creation of forms via the admin panel for collecting user data on the front end. Forms are composed of filament field components and support all Laravel validation rules. Form responses can be rendered on the front end or exported to .csv.
| Filament | Filament Form Builder | Documentation |
|---|---|---|
| 4.x/5.x | 4.x | Current |
| 3.x | 1.x | Check the docs |
Install the plugin via Composer:
This package is not yet on Packagist. Add the repository to your composer.json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/TappNetwork/Filament-Form-Builder"
}
],
}
composer require tapp/filament-form-builder:"^4.0"
You can publish the migrations with:
php artisan vendor:publish --tag="filament-form-builder-migrations"
[!WARNING]
If you are using multi-tenancy please see the "Multi-Tenancy Support" instructions below before publishing and running migrations.
You can run the migrations with:
php artisan migrate
You can publish the view file with:
php artisan vendor:publish --tag="filament-form-builder-views"
You can publish the config file with:
php artisan vendor:publish --tag="filament-form-builder-config"
The package provides three plugins for different panel types:
FilamentFormBuilderPlugin)Add this plugin to your admin panel to manage forms, fields, and entries. This plugin registers the FilamentFormResource which provides CRUD operations for forms.
use Tapp\FilamentFormBuilder\FilamentFormBuilderPlugin;
// In app/Providers/Filament/AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentFormBuilderPlugin::make(),
//...
]);
}
FilamentFormBuilderGuestPlugin)Add this plugin to your guest panel (for unauthenticated users) to display forms and form entries. This plugin registers the ShowForm and ShowEntry pages for public access.
use Tapp\FilamentFormBuilder\FilamentFormBuilderGuestPlugin;
// In app/Providers/Filament/GuestPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentFormBuilderGuestPlugin::make(),
//...
]);
}
FilamentFormBuilderFrontendPlugin)Add this plugin to your app/frontend panel (for authenticated users) to display forms and form entries. This plugin registers the ShowForm and ShowEntry pages for authenticated access.
use Tapp\FilamentFormBuilder\FilamentFormBuilderFrontendPlugin;
// In app/Providers/Filament/AppPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentFormBuilderFrontendPlugin::make(),
//...
]);
}
Forms can be accessed via the following routes (configured in config/filament-form-builder.php):
/forms/{form} - Displays a form for submission/entries/{entry} - Displays a submitted form entryThe routes automatically use the appropriate panel (guest or app) based on authentication status. Forms with permit_guest_entries enabled can be viewed by unauthenticated users in the guest panel, while authenticated users will be redirected to the app panel.
You can customize the package behavior by publishing and editing the config file:
php artisan vendor:publish --tag="filament-form-builder-config"
Key configuration options include:
guest-panel-id, app-panel-id)login-route)ShowForm and ShowEntry pages for guest and app panelsSetFormPanel middleware for panel context switchingfilament-form-uri, filament-form-user-uri)See config/filament-form-builder.php for all available configuration options.
You can restrict who can view or export form entries on a per-form basis. When Private entries is enabled for a form, the package uses your application’s policy to decide visibility.
Register a policy for Tapp\FilamentFormBuilder\Models\FilamentForm (e.g. FilamentFormPolicy).
Implement viewEntries on that policy with this exact method name and signature. Put all your logic here (e.g. “Admin only”); no gate is required:
// e.g. app/Policies/FilamentFormPolicy.php
public function viewEntries(User $user, FilamentForm $form): bool
{
if (! (bool) $form->private_entries) {
return true;
}
return $user->hasRole('Admin'); // or your own rules
}
The package calls $user->can('viewEntries', $ownerRecord) when:
If your policy does not define viewEntries, the package does not restrict the Entries tab or export (all users who can view the form see them).
Entry-level visibility: In your FilamentFormUser policy view() method, when the entry’s form has private_entries, delegate to the same policy so individual entry view links are restricted:
if ($entry->filamentForm && (bool) $entry->filamentForm->private_entries) {
return $user->can('viewEntries', $entry->filamentForm);
}
Form edit UI: The Private entries toggle on the form is disabled when the form is private and the current user fails viewEntries, so they cannot turn the setting off to gain access.
No gate and no extended relation manager are required—the package’s relation manager and resource use the policy when viewEntries is present.
Add this to your tailwind.config.js content section:
content: [
...
"./vendor/tapp/**/*.blade.php",
],
You can disable the redirect when including the Form/Show component inside of another component by passing the 'blockRedirect' prop as follows
@livewire('tapp.filament-form-builder.livewire.filament-form.show', ['form' => $test->form, 'blockRedirect' => true])
This plugin includes comprehensive support for multi-tenancy, allowing you to scope forms, form fields, and entries to specific tenants (e.g., Teams, Organizations, Companies).
You MUST enable and configure tenancy BEFORE running migrations! The migrations check the tenancy configuration to determine whether to add tenant columns to the database tables. Enabling tenancy after running migrations will require manual database modifications.
Update your config/filament-form-builder.php configuration file:
'tenancy' => [
// Enable tenancy support
'enabled' => true,
// The Tenant model class
'model' => \App\Models\Team::class,
// Optional: Override the tenant relationship name
// (defaults to snake_case of tenant model class name: Team -> 'team')
'relationship_name' => null,
// Optional: Override the tenant foreign key column name
// (defaults to relationship_name + '_id': 'team' -> 'team_id')
'column' => null,
],
config/filament-form-builder.php (set enabled to true and specify your tenant model)php artisan vendor:publish --tag="filament-form-builder-migrations"php artisan migrateuse Filament\Panel;
use App\Models\Team;
use Tapp\FilamentFormBuilder\FilamentFormBuilderPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->tenant(Team::class)
->plugins([
FilamentFormBuilderPlugin::make(),
]);
}
When tenancy is enabled:
/admin/{tenant-slug}/filament-formsTo disable tenancy, set enabled to false in your configuration:
'tenancy' => [
'enabled' => false,
'model' => null,
],
The FilamentForm/Show component emits an 'entrySaved' event when a form entry is saved. You can handle this event in a parent component to as follows.
class ParentComponent extends Component
{
protected $listeners = ['entrySaved'];
public function entrySaved(FilamentFormUser $survey)
{
// custom logic you would like to add to form entry saving logic
}
}
The component also emits a Laravel event that you can listen to in your event service provider
// In your EventServiceProvider.php
protected $listen = [
\Tapp\FilamentFormBuilder\Events\EntrySaved::class => [
\App\Listeners\HandleFormSubmission::class,
],
];
// Create a listener class
namespace App\Listeners;
use Tapp\FilamentFormBuilder\Events\EntrySaved;
class HandleFormSubmission
{
public function handle(EntrySaved $event): void
{
// Access the form entry
$entry = $event->entry;
// Perform actions with the form data
// For example, send notifications, update other records, etc.
}
}
How can I help you explore Laravel packages today?