solution-forest / simple-contact-form
This is my package simple-contact-form
Fund package maintenance!
SolutionForest
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
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.
Features
- 🚀 Easy Installation - Get up and running in minutes
- 📝 Basic Form Management - Create and manage contact forms
- 📧 Email Notifications - Receive form submissions via email
- 📱 Responsive Design - Mobile-friendly forms out of the box
Coming Soon
- 📁 File Upload - Support for file attachments in forms
- 🪝 Form Hooks - Before/after submit hooks for custom logic
- ⚙️ Configuration Options - Adjustable settings for forms
- 💾 Submission Storage - Save and manage form submissions
Installation
You can install the package via composer:
composer require solution-forest/simple-contact-form
You can publish and run the migrations with:
php artisan vendor:publish --tag="simple-contact-form-migrations"
php artisan migrate
Register the plugin in your Panel provider:
use SolutionForest\SimpleContactForm\SimpleContactFormPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ SimpleContactFormPlugin::make(), ]); }
Configuration
Customizing Translations
If you need to modify the translations, publish the language files:
php artisan vendor:publish --tag="simple-contact-form-lang"
This will copy the language files to your application's lang
directory where you can edit them.
Email Setting
For the plugin to send emails properly, ensure your Laravel mail configuration is set up correctly in your .env
file:
MAIL_MAILER=smtp MAIL_HOST=smtp.example.com MAIL_PORT=587 MAIL_USERNAME=your-email@example.com MAIL_PASSWORD=your-email-password MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=your-email@example.com MAIL_FROM_NAME="${APP_NAME}"
Usage
Creating a Form
- Navigate to the "Contact Forms" section in your Filament admin panel
- Click "Create Form"
- Configure the basic form settings:
- Form Name
- Email Content
- Success Message
- Error Message
- Email Subject
- Add fields using the form builder:
- Text Input
- Email Input
- Textarea
- Select Dropdown
- Radio Buttons
- Checkboxes
Displaying Forms
Use the Blade component with form id in your views:
<x-simple-contact-form :form="1" />
Preview
Common Issues
Emails not sending:
- Check your mail configuration in
.env
- Verify SMTP credentials
- Check Laravel log files
- smtp doc
Lost style in view:
- Make sure you're using Tailwind CSS v3 (FilamentPHP 3 only supports Tailwind v3)
- If you've upgraded to Tailwind v4, downgrade to v3 with
npm install tailwindcss@^3.0
- you can follow the guide of filament form installation : [https://filamentphp.com/docs/3.x/forms/installation]
- Make sure your
tailwind.config.js
looks like this:import preset from './vendor/filament/support/tailwind.config.preset' export default { presets: [preset], content: [ './app/Filament/**/*.php', './resources/views/filament/**/*.blade.php', './vendor/filament/**/*.blade.php', ], }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.