|
| 1 | +--- |
| 2 | +name: Simple Contact Form Pro |
| 3 | +slug: solution-forest-simple-contact-form-pro |
| 4 | +anystack_id: 9f7181c0-a0bb-4d04-9b93-3f0e2b4e54e4 |
| 5 | +checkout_url: https://checkout.anystack.sh/simple-contact-form-pro?via=arf178 |
| 6 | +author_slug: solution-forest |
| 7 | +categories: [form-builder, form-field] |
| 8 | +description: A lightweight, customizable contact form plugin for FilamentPHP that provides an easy-to-use alternative to Contact Form 7. Build and manage contact forms with a simple, intuitive interface directly from your Filament admin panel. |
| 9 | +github_repository: solutionforest/simple-contact-form-pro |
| 10 | +has_dark_theme: true |
| 11 | +has_translations: true |
| 12 | +versions: [3, 4] |
| 13 | +publish_date: 2025-08-26 |
| 14 | +--- |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +# Simple Contact Form Pro - FilamentPHP Plugin |
| 19 | + |
| 20 | +**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. |
| 21 | + |
| 22 | +[](https://packagist.org/packages/solutionforest/simple-contact-form-pro) |
| 23 | +[](https://github.com/solutionforest/simple-contact-form-pro/actions?query=workflow%3Arun-tests+branch%3Amain) |
| 24 | +[](https://github.com/solutionforest/simple-contact-form-pro/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain) |
| 25 | +[](https://packagist.org/packages/solutionforest/simple-contact-form-pro) |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## 🚀 Pro Features |
| 30 | + |
| 31 | +- 🪝 **Hooks** - Add custom logic before/after form submit (fully configurable) |
| 32 | +- 📁 **File Upload** - Support for file attachments, with validation and storage control |
| 33 | +- 💾 **Mail Record** - Store and manage all sent emails and attachments |
| 34 | +- ⚙️ **Full Config Control** - All features and behaviors can be controlled via config file |
| 35 | +- 📝 **All Base Features** - Inherits all features from the free version |
| 36 | + |
| 37 | +## Base Features (from Simple Contact Form) |
| 38 | +- Easy installation |
| 39 | +- Basic form management |
| 40 | +- Email notifications |
| 41 | +- Responsive design |
| 42 | + |
| 43 | +### Supported Filament versions |
| 44 | + |
| 45 | +| Filament Version | Plugin Version | |
| 46 | +| ---------------- | -------------- | |
| 47 | +| v3 | 0.0.4 | |
| 48 | +| v4 | 2.0.2 | |
| 49 | + |
| 50 | +## Installation |
| 51 | + |
| 52 | +```bash |
| 53 | +composer require solutionforest/simple-contact-form-pro |
| 54 | +``` |
| 55 | + |
| 56 | +For Filament v4, use the v2.0.1 version: |
| 57 | + |
| 58 | +```bash |
| 59 | +composer require solution-forest/simple-contact-form:^2.0.2 |
| 60 | +``` |
| 61 | + |
| 62 | +Publish config and migrations: |
| 63 | + |
| 64 | +```bash |
| 65 | +php artisan vendor:publish --tag="simple-contact-form-pro-config" |
| 66 | +php artisan vendor:publish --tag="simple-contact-form-migrations" |
| 67 | +php artisan vendor:publish --tag="simple-contact-form-pro-migrations" |
| 68 | +php artisan migrate |
| 69 | +``` |
| 70 | + |
| 71 | +Register the plugin in your Filament Panel provider: |
| 72 | + |
| 73 | +```php |
| 74 | +use Solutionforest\SimpleContactFormPro\SimpleContactFormProPlugin; |
| 75 | + |
| 76 | +public function panel(Panel $panel): Panel |
| 77 | +{ |
| 78 | + return $panel |
| 79 | + // ... |
| 80 | + ->plugins([ |
| 81 | + SimpleContactFormProPlugin::make(), |
| 82 | + ]); |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +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: |
| 87 | + |
| 88 | +1. **Filament v3 with Tailwind v3:** |
| 89 | + Follow the official Filament installation instructions: [https://filamentphp.com/docs/3.x/forms/installation](https://filamentphp.com/docs/3.x/forms/installation). |
| 90 | + |
| 91 | +2. **Filament v3 with Tailwind v4:** |
| 92 | + Publish the built-in CSS assets with the following command: |
| 93 | + |
| 94 | + ```bash |
| 95 | + php artisan vendor:publish --tag="simple-contact-form-assets" |
| 96 | + ``` |
| 97 | + |
| 98 | +3. **Filament v4 (expects Tailwind v4):** |
| 99 | + Add the following to your `app.css` or your stylesheet: |
| 100 | + |
| 101 | + ```css |
| 102 | + @import '../../vendor/filament/filament/resources/css/theme.css'; |
| 103 | +
|
| 104 | + @source '../../app/Filament/**/*'; |
| 105 | + @source '../../resources/views/filament/**/*'; |
| 106 | + ``` |
| 107 | + |
| 108 | + Then build your assets: |
| 109 | + |
| 110 | + ```bash |
| 111 | + npm run build |
| 112 | + ``` |
| 113 | + |
| 114 | + |
| 115 | +## Usage |
| 116 | + |
| 117 | +### Creating a Pro Form |
| 118 | +1. Go to "Contact Forms" in your Filament admin panel |
| 119 | +2. Click "Create Form" |
| 120 | +3. Configure advanced options (file upload, hooks, etc.) |
| 121 | +4. Add fields and set up mail/recording as needed |
| 122 | + |
| 123 | +### Displaying the Form in front end |
| 124 | +Use the Blade component: |
| 125 | + |
| 126 | +```blade |
| 127 | +<x-simple-contact-form :form="1" /> |
| 128 | +``` |
| 129 | + |
| 130 | +## Configuration |
| 131 | + |
| 132 | +You can customize the plugin's resources using the following options: |
| 133 | +
|
| 134 | +```php |
| 135 | +SimpleContactFormProPlugin::make() |
| 136 | + ->modelLabel('Custom Contact Form') // Singular label for the model |
| 137 | + ->pluralModelLabel('Custom Contact Forms') // Plural label for the model |
| 138 | + ->navigationLabel('My Contact Forms') // Label in the navigation menu |
| 139 | + ->navigationIcon('heroicon-o-envelope') // Icon for navigation |
| 140 | + ->navigationGroup('Communication') // Group in the navigation |
| 141 | + ->navigationSort(100) // Sort order in navigation |
| 142 | + ->navigationParentItem(null) // Parent navigation item (if any) |
| 143 | + ->slug('contact') // Custom route slug |
| 144 | + ->shouldSkipAuth(false) // Require authentication |
| 145 | + ->shouldRegisterNavigation(true) // Show in navigation |
| 146 | + ->hasTitleCaseModelLabel(true); // Use title case for labels |
| 147 | +``` |
| 148 | +All features (hooks, file upload, mail record, etc.) can be enabled/disabled and customized in `config/simple-contact-form-pro.php`. |
| 149 | +
|
| 150 | +### Enable/Disable Mail Send |
| 151 | +```php |
| 152 | +'mail' => [ |
| 153 | + 'enable' => true, |
| 154 | + ], |
| 155 | +``` |
| 156 | +### Enable/Disable Mail Record |
| 157 | +```php |
| 158 | +'mail_record' => [ |
| 159 | + 'enable' => true, |
| 160 | +], |
| 161 | +``` |
| 162 | +
|
| 163 | +### File Upload Settings |
| 164 | +```php |
| 165 | +'fileSystems' => [ |
| 166 | + 'disk' => env('FILESYSTEM_DISK', 'local'), // default local |
| 167 | + 'directory' => 'livewire-tmp', // you can change which directory save to |
| 168 | + 'save' => false, // if false , it will delete afte mail send |
| 169 | + ], |
| 170 | +``` |
| 171 | +
|
| 172 | +### File Upload Notes |
| 173 | +
|
| 174 | +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](https://filamentphp.com/docs/3.x/forms/fields/file-upload#uploading-large-files). |
| 175 | +
|
| 176 | +### Hooks |
| 177 | +You can register before/after submit hooks in your config or via event listeners. |
| 178 | +
|
| 179 | +### Hooks Usage |
| 180 | +You can extend the built-in `ContactFormListener` for more structured handling: |
| 181 | +
|
| 182 | +```php |
| 183 | +<?php |
| 184 | +
|
| 185 | +namespace App\Listeners; |
| 186 | +
|
| 187 | +use Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener; |
| 188 | +use Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm; |
| 189 | +use Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm; |
| 190 | +
|
| 191 | +class YourCutsomeListenr extends ContactFormListener |
| 192 | +{ |
| 193 | + //these two function is must when you extends ContactFormListener. |
| 194 | + public function handleContactFormCreating(BeforeCreateContactForm $event): void |
| 195 | + { |
| 196 | + //your custom logic before record create |
| 197 | + } |
| 198 | +
|
| 199 | + public function handleContactFormCreated(AfterCreateContactForm $event): void |
| 200 | + { |
| 201 | + //your custom logic after record create |
| 202 | + } |
| 203 | +} |
| 204 | +``` |
| 205 | +
|
| 206 | +And then you will found out following in the config file: |
| 207 | +
|
| 208 | +```php |
| 209 | + 'events' => [ |
| 210 | + Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm::class => [ |
| 211 | + Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreating', |
| 212 | + ], |
| 213 | + Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm::class => [ |
| 214 | + Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreated', |
| 215 | + ], |
| 216 | + ], |
| 217 | +``` |
| 218 | +
|
| 219 | +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. |
| 220 | +
|
| 221 | +```php |
| 222 | + 'events' => [ |
| 223 | + // comment out this part for using your custom listener |
| 224 | + // Solutionforest\SimpleContactFormPro\Events\BeforeCreateContactForm::class => [ |
| 225 | + // Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreating', |
| 226 | + // ], |
| 227 | + // Solutionforest\SimpleContactFormPro\Events\AfterCreateContactForm::class => [ |
| 228 | + // Solutionforest\SimpleContactFormPro\Listeners\ContactFormListener::class . '@handleContactFormCreated', |
| 229 | + // ], |
| 230 | + ], |
| 231 | +``` |
| 232 | +
|
| 233 | +### Customizing Translations |
| 234 | +
|
| 235 | +If you need to modify the translations, publish the language files: |
| 236 | +
|
| 237 | +```bash |
| 238 | +php artisan vendor:publish --tag="simple-contact-form-lang" |
| 239 | +php artisan vendor:publish --tag="simple-contact-form-pro-lang" |
| 240 | +``` |
| 241 | +
|
| 242 | +
|
| 243 | +
|
| 244 | +## Testing |
| 245 | +
|
| 246 | +```bash |
| 247 | +composer test |
| 248 | +``` |
| 249 | +
|
| 250 | +## Changelog |
| 251 | +
|
| 252 | +See [CHANGELOG](CHANGELOG.md) for recent changes. |
| 253 | +
|
| 254 | +## Contributing |
| 255 | +
|
| 256 | +We welcome contributions! See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details. |
| 257 | +
|
| 258 | +## Security Vulnerabilities |
| 259 | +
|
| 260 | +Please review [our security policy](../../security/policy) for how to report security issues. |
| 261 | +
|
| 262 | +## Credits |
| 263 | +
|
| 264 | +- [hayward](https://github.com/solutionforest) |
| 265 | +- [All Contributors](../../contributors) |
| 266 | +
|
| 267 | +## License |
| 268 | +
|
| 269 | +The MIT License (MIT). See [License File](LICENSE.md) for details. |
| 270 | +
|
| 271 | +<p align="center"><a href="https://solutionforest.com" target="_blank"><img src="https://github.com/solutionforest/.github/blob/main/docs/images/sf.png?raw=true" width="200"></a></p> |
| 272 | +
|
| 273 | +## About Solution Forest |
| 274 | +
|
| 275 | +[Solution Forest](https://solutionforest.com) is a web development agency based in Hong Kong. We help customers solve their problems and love open source. |
| 276 | +
|
| 277 | +We have built a collection of best-in-class products: |
| 278 | +
|
| 279 | +- [InspireCMS](https://inspirecms.net): A full-featured Laravel CMS with everything you need out of the box. Build smarter, ship faster with our complete content management solution. |
| 280 | +- [Filaletter](https://filaletter.solutionforest.net): Filaletter - Filament Newsletter Plugin |
0 commit comments