Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Contactable

Contactable Laravel Package

labrodev/contactable

Configurable Livewire contact form for Laravel. Define fields in config, optionally persist submissions to an Eloquent model, and send notifications via mail, log, or webhook. Supports published views and translation-ready labels/messages.

View on GitHub
Deep Wiki
Context7

A configurable Livewire contact form for Laravel with optional model persistence and pluggable notify channels (mail, log, webhook).

Frequently asked questions about Contactable
How do I install and set up Labrodev Contactable in a Laravel 12+ project?
Run `composer require labrodev/contactable`, then publish the config with `php artisan vendor:publish --tag=contactable-config`. Edit `config/contactable.php` to define fields, model persistence, and notification channels. Ensure Livewire 4+ is installed and included in your Blade layouts.
Can I use Contactable without saving submissions to a database?
Yes. Set the `model` key in `config/contactable.php` to `null` to disable Eloquent persistence. The form will still work for notifications (mail, log, or webhook) without requiring a database table.
What validation rules are supported, and how do I customize them?
Contactable supports standard Laravel validation rules (e.g., `required`, `email`, `min:5`). Define them in the `rules` key of each field in `config/contactable.php`. Custom messages can be added via the `messages` key or translated using Laravel’s `__()` helper.
How do I handle notifications (mail, webhook, log) if one fails?
Contactable processes notifications sequentially. If mail fails, the webhook or log will still execute unless you implement custom error handling. For resilience, consider queueing notifications (e.g., `Mail::to()->later()`) or adding fallback logic in your notification channel.
Is Contactable compatible with Laravel 11 or older versions?
No. Contactable requires **Laravel 12+** and **PHP 8.2+** due to Livewire 4+ dependencies. If you’re on Laravel 11 or older, you’ll need to upgrade or explore alternatives like `spatie/laravel-contact` for Blade-based forms.
Can I customize the form’s success message or redirect behavior dynamically?
Yes. Use translation keys (e.g., `contactable::success`) or literal strings in `config/contactable.php` for the success message. For dynamic redirects, set `redirect_route` to a named route or use a closure in a custom Livewire component extending `Contactable`.
How do I add a file upload field to the contact form?
Define a field with `type: 'file'` in `config/contactable.php` and add `rules: ['file']` (or custom rules). Publish the views and modify `resources/views/vendor/contactable/livewire/contactable.blade.php` to include a file input. Handle storage manually in a custom Livewire component if needed.
What if I need rate limiting or CSRF protection beyond Laravel’s defaults?
Contactable relies on Laravel’s built-in protections (CSRF middleware, rate limiting). Add `@method('POST')` to your Livewire component or wrap the form in a route middleware (e.g., `throttle:60,1`). For Livewire-specific rate limiting, use `use ThrottlesRequests;` in a custom component.
Are there alternatives to Contactable for non-Livewire Laravel projects?
For Blade-only projects, consider `spatie/laravel-contact` or `laravelcollective/html`. If using Inertia.js/Vue/React, build a custom API endpoint with Laravel’s Form Request validation and handle frontend submission logic separately. Contactable is Livewire-specific.
How do I test Contactable’s form submission and notifications in CI?
Mock notifications in tests by overriding the `notify()` method in a custom Livewire component or using Laravel’s `fake()` helpers. Test validation with `Livewire::test()` and assert flash messages or redirects. For webhooks, use `Http::fake()` to verify requests.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky