The Pro version of Simple Contact Form adds advanced features like hooks, file upload, mail record, and full config control, making it the ultimate contact form solution for FilamentPHP projects.
Filament Version | Plugin Version |
---|---|
v3 | 0.0.4 |
v4 | 2.0.2 |
composer require solutionforest/simple-contact-form-pro
For Filament v4, use the v2.0.1 version:
composer require solution-forest/simple-contact-form:^2.0.2
Publish config and migrations:
php artisan vendor:publish --tag="simple-contact-form-pro-config"php artisan vendor:publish --tag="simple-contact-form-migrations"php artisan vendor:publish --tag="simple-contact-form-pro-migrations"php artisan migrate
Register the plugin in your Filament Panel provider:
use Solutionforest\SimpleContactFormPro\SimpleContactFormProPlugin; public function panel(Panel $panel): Panel{ return $panel // ... ->plugins([ SimpleContactFormProPlugin::make(), ]);}
Simple Contact Form provides a Filament form that can be used outside the Filament panel, but it requires Filament styles. There are several ways to set this up depending on your environment:
Filament v3 with Tailwind v3:
Follow the official Filament installation instructions: https://filamentphp.com/docs/3.x/forms/installation.
Filament v3 with Tailwind v4:
Publish the built-in CSS assets with the following command:
php artisan vendor:publish --tag="simple-contact-form-assets"
Filament v4 (expects Tailwind v4):
Add the following to your app.css
or your stylesheet:
@import '../../vendor/filament/filament/resources/css/theme.css'; @source '../../app/Filament/**/*';@source '../../resources/views/filament/**/*';
Then build your assets:
npm run build
Use the Blade component:
<x-simple-contact-form :form="1" />
You can customize the plugin's resources using the following options:
SimpleContactFormProPlugin::make() ->modelLabel('Custom Contact Form') // Singular label for the model ->pluralModelLabel('Custom Contact Forms') // Plural label for the model ->navigationLabel('My Contact Forms') // Label in the navigation menu ->navigationIcon('heroicon-o-envelope') // Icon for navigation ->navigationGroup('Communication') // Group in the navigation ->navigationSort(100) // Sort order in navigation ->navigationParentItem(null) // Parent navigation item (if any) ->slug('contact') // Custom route slug ->shouldSkipAuth(false) // Require authentication ->shouldRegisterNavigation(true) // Show in navigation ->hasTitleCaseModelLabel(true); // Use title case for labels
All features (hooks, file upload, mail record, etc.) can be enabled/disabled and customized in config/simple-contact-form-pro.php
.
'mail' => [ 'enable' => true, ],
'mail_record' => [ 'enable' => true,],
'fileSystems' => [ 'disk' => env('FILESYSTEM_DISK', 'local'), // default local 'directory' => 'livewire-tmp', // you can change which directory save to 'save' => false, // if false , it will delete afte mail send ],
While you can configure file size limits in the resource form, ensure that post_max_size
and upload_max_filesize
in your php.ini
are set higher than your configured limits. For more information about handling large file uploads, visit the Filament documentation.
You can register before/after submit hooks in your config or via event listeners.
You can extend the built-in ContactFormListener
for more structured handling:
<?php namespace App\Listeners; use Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener;use Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm;use Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm; class YourCutsomeListenr extends ContactFormListener{ //these two function is must when you extends ContactFormListener. public function handleContactFormCreating(BeforeCreateContactForm $event): void { //your custom logic before record create } public function handleContactFormCreated(AfterCreateContactForm $event): void { //your custom logic after record create }}
And then you will found out following in the config file:
'events' => [ Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm::class => [ Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreating', ], Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm::class => [ Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreated', ], ],
In Laravel 11 or above, listeners will be registered automatically once you create them under the app/Listeners
directory, so there would be no need to register again, otherwise the event will run twice.
'events' => [ // comment out this part for using your custom listener // Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm::class => [ // Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreating', // ], // Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm::class => [ // Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreated', // ], ],
If you need to modify the translations, publish the language files:
php artisan vendor:publish --tag="simple-contact-form-lang"php artisan vendor:publish --tag="simple-contact-form-pro-lang"
composer test
See CHANGELOG for recent changes.
We welcome contributions! See CONTRIBUTING.md for details.
Please review our security policy for how to report security issues.
The MIT License (MIT). See License File for details.
Solution Forest is a web development agency based in Hong Kong. We help customers solve their problems and love open source.
We have built a collection of best-in-class products: