sfolador / support
This package helps you to create a support page and manage the support requests on Laravel.
Fund package maintenance!
Simone Folador
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/sfolador/support
Requires
- php: ^8.3|^8.4
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.1||^9.6
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
README
A Laravel package that provides a ready-to-use support page with a contact form, email notifications, and optional Filament admin panel integration.
Features
- Beautiful, responsive support form with Tailwind CSS styling
- Email notifications for new support requests
- Optional Google reCAPTCHA v2 protection
- Customizable support request types
- Translatable (i18n support)
- Optional Filament admin panel integration
- Fully configurable routes, middleware, and layout
Requirements
- PHP 8.3 or higher
- Laravel 11.x or 12.x
Installation
Install the package via Composer:
composer require sfolador/support
Publish and run the migrations:
php artisan vendor:publish --tag="support-migrations"
php artisan migrate
Publish the config file:
php artisan vendor:publish --tag="support-config"
Configuration
After publishing, the configuration file will be located at config/support.php:
return [ /* |-------------------------------------------------------------------------- | Support Email |-------------------------------------------------------------------------- | | The email address where support requests will be sent. | */ 'support_email' => env('SUPPORT_EMAIL'), /* |-------------------------------------------------------------------------- | Support Types |-------------------------------------------------------------------------- | | The types of support requests that users can submit. | The key is stored in the database, the value is displayed to the user. | */ 'support_types' => [ 'issue' => 'Technical Issue', 'email' => 'Email Support', 'data_removal' => 'Data Removal Request', 'inquiry' => 'General Inquiry', ], /* |-------------------------------------------------------------------------- | reCAPTCHA Configuration |-------------------------------------------------------------------------- | | Enable or disable reCAPTCHA for the support form. | If enabled, you must provide your site key and secret key. | */ 'recaptcha' => [ 'enabled' => env('SUPPORT_RECAPTCHA_ENABLED', false), 'site_key' => env('SUPPORT_RECAPTCHA_SITE_KEY'), 'secret_key' => env('SUPPORT_RECAPTCHA_SECRET_KEY'), ], /* |-------------------------------------------------------------------------- | Routes Configuration |-------------------------------------------------------------------------- | | Configure the middleware and route prefix for the support page. | */ 'middleware' => ['web'], 'route_prefix' => 'support', /* |-------------------------------------------------------------------------- | Layout Configuration |-------------------------------------------------------------------------- | | The layout that the support page should extend. | Use 'support::layouts.app' for the default layout, | or specify your own (e.g., 'layouts.app'). | */ 'layout' => 'support::layouts.app', /* |-------------------------------------------------------------------------- | Page Title |-------------------------------------------------------------------------- | | The title displayed on the support page. | */ 'page_title' => 'Contact Support', ];
Environment Variables
Add these variables to your .env file:
# Required: Email address to receive support requests SUPPORT_EMAIL=support@yourdomain.com # Optional: Enable reCAPTCHA protection SUPPORT_RECAPTCHA_ENABLED=true SUPPORT_RECAPTCHA_SITE_KEY=your-site-key SUPPORT_RECAPTCHA_SECRET_KEY=your-secret-key
Usage
Once installed, the support page is available at /support (or your configured route_prefix).
Routes
The package registers two routes:
| Method | URI | Name | Description |
|---|---|---|---|
| GET | /support | support | Display the support form |
| POST | /support | support.store | Submit a support request |
Using Your Own Layout
By default, the package uses a minimal standalone layout. To use your application's layout:
- Update
config/support.php:
'layout' => 'layouts.app', // Your layout file
- Make sure your layout has the following sections:
@yield('title')- Page title@yield('scripts')- For reCAPTCHA script (if enabled)@yield('content')- Main content
Customizing Views
Publish the views to customize them:
php artisan vendor:publish --tag="support-views"
The views will be published to resources/views/vendor/support/.
Customizing Translations
Publish the translation files:
php artisan vendor:publish --tag="support-translations"
The translations will be published to lang/vendor/support/.
Custom Support Types
Modify the support_types array in the config to add or change support request types:
'support_types' => [ 'bug' => 'Bug Report', 'feature' => 'Feature Request', 'billing' => 'Billing Question', 'other' => 'Other', ],
Filament Integration
If you're using Filament, this package provides a ready-to-use admin panel for managing support requests.
Setup
Register the plugin in your AdminPanelProvider:
use Sfolador\Support\Filament\SupportPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ SupportPlugin::make(), ]); }
This adds a "Support Requests" resource to your admin panel where you can:
- View all support requests
- Filter by support type
- View individual request details
- Delete requests
Database
The package creates a support_requests table with the following structure:
| Column | Type | Description |
|---|---|---|
| id | bigint | Primary key |
| name | string | Requester's name |
| string | Requester's email | |
| support_type | string | Type of support request |
| content | text | Request details |
| created_at | timestamp | Creation timestamp |
| updated_at | timestamp | Update timestamp |
Accessing Support Requests
You can query support requests using the SupportRequest model:
use Sfolador\Support\Models\SupportRequest; // Get all requests $requests = SupportRequest::all(); // Get requests by type $issues = SupportRequest::where('support_type', 'issue')->get(); // Get recent requests $recent = SupportRequest::latest()->take(10)->get();
Email Notifications
When a support request is submitted, an email notification is sent to the configured support_email address. The email includes:
- Requester's name
- Requester's email
- Support type
- Request content
Make sure your Laravel mail configuration is properly set up.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING 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.