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 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

Technical Evaluation

Architecture Fit

  • Pros:
    • Livewire Integration: Aligns well with modern Laravel frontend architectures (Livewire 4+), avoiding heavy SPA frameworks while maintaining reactivity.
    • Pluggable Notifications: Supports decoupled notification channels (mail, log, webhook), enabling extensibility for future use cases (e.g., Slack, SMS).
    • Model Persistence: Optional Eloquent storage allows for auditability or follow-ups without forcing a database dependency.
    • Config-Driven: Centralized configuration reduces boilerplate and makes the component adaptable to different form requirements.
  • Cons:
    • Livewire Dependency: Tight coupling to Livewire may limit adoption in projects using Inertia.js, Vue/React, or traditional Blade forms.
    • Limited Validation Flexibility: Field rules are predefined in config; complex validation (e.g., dynamic rules) may require customization.
    • No Built-in CSRF/Rate Limiting: Relies on Laravel’s default protections, which may need explicit configuration for high-traffic forms.

Integration Feasibility

  • Laravel 12+ Compatibility: Requires PHP 8.2+, which may necessitate dependency updates in older projects.
  • Livewire 4+ Requirement: Projects using Livewire 3.x would need an upgrade path (minor breaking changes possible).
  • Database Schema: If using model persistence, the TPM must define a migration (e.g., ContactRequest table) and handle schema evolution.
  • Notification Channels:
    • Mail: Requires Laravel’s mail configuration (e.g., SMTP, Mailgun).
    • Webhook: Needs endpoint validation and error handling (e.g., retries for failed requests).
    • Log: Simple but may require log management (e.g., rotation, monitoring).

Technical Risk

  • Low-Medium:
    • Configuration Overhead: Misconfigured fields/rules could break the form or lead to validation errors. Requires thorough testing.
    • Livewire State Management: Custom Livewire components might conflict with existing state management (e.g., global Livewire hooks).
    • Notification Failures: Webhook/log failures could silently drop submissions; requires monitoring (e.g., Laravel Horizon for queues).
  • Mitigation:
    • Testing: Validate form submission flows (success, validation errors, notification failures) in staging.
    • Fallbacks: Implement retry logic for webhooks or fallback to logging if mail fails.
    • Documentation: Capture edge cases (e.g., "What if the webhook endpoint is down?").

Key Questions

  1. Frontend Stack:
    • Is Livewire 4+ already adopted in the project, or is this a new integration?
    • Are there existing Livewire components that might conflict with Contactable (e.g., global scripts, middleware)?
  2. Notification Strategy:
    • Which channels are prioritized (mail/webhook/log), and what are the SLAs for delivery?
    • Are there existing services (e.g., Postmark, Twilio) that need integration?
  3. Data Persistence:
    • Should submissions be stored in the database, and if so, what fields are required for analytics/follow-ups?
    • Are there compliance requirements (e.g., GDPR) for data retention/deletion?
  4. Customization Needs:
    • Are there non-standard form fields (e.g., file uploads, dynamic dropdowns) that require custom Livewire components?
    • Should the success message or redirect behavior be dynamic (e.g., per-user)?
  5. Performance:
    • Could high submission volumes (e.g., spam) impact Livewire’s memory usage or database performance?
    • Is rate limiting (e.g., Laravel Throttle) needed at the route or form level?

Integration Approach

Stack Fit

  • Best Fit:
    • Laravel 12+ with Livewire 4: Native integration with minimal overhead.
    • Projects Using Livewire for Forms: Ideal for replacing manual Blade forms or simplifying complex contact flows.
  • Partial Fit:
    • Inertia.js/Vue/React: Possible but requires wrapping the Livewire component in a custom Inertia resource (adds complexity).
    • Traditional Blade Forms: Less beneficial unless migrating to Livewire; manual validation/CSRF handling would still be needed.
  • Non-Fit:
    • API-First Projects: If contact forms are submitted via API (e.g., React frontend), this package adds unnecessary Livewire coupling.

Migration Path

  1. Assessment Phase:
    • Audit existing contact forms (Blade/Livewire) to identify common fields, validation rules, and notification targets.
    • Document gaps (e.g., "We need file uploads" or "Submissions must trigger a Slack alert").
  2. Proof of Concept:
    • Install the package in a staging environment.
    • Configure a minimal form (e.g., name/email/message) with mail notifications.
    • Test submission flow, validation, and email delivery.
  3. Incremental Rollout:
    • Phase 1: Replace one Blade form with Contactable (e.g., "Contact Us" page).
    • Phase 2: Add model persistence and webhook notifications for critical forms.
    • Phase 3: Customize fields/config for project-specific needs (e.g., localization, dynamic rules).
  4. Deprecation:
    • Phase out legacy form handlers (e.g., ContactFormRequest) in favor of Contactable’s config-driven approach.

Compatibility

  • Laravel Services:
    • Mail: Works with Laravel’s mail drivers (test SMTP/queue configurations).
    • Queue: Webhook/log notifications should use queues (mail:send, events) to avoid blocking.
    • Validation: Extend FormRequest classes if dynamic rules are needed (e.g., after rules based on other fields).
  • Third-Party Conflicts:
    • Livewire Plugins: Check for conflicts with packages like Livewire Tables or Livewire Alpine.
    • Frontend Assets: Ensure @livewireScripts/@livewireStyles are loaded before the form component.
  • Database:
    • If using model persistence, create a migration for the ContactRequest table (or extend an existing one). Example:
      Schema::create('contact_requests', function (Blueprint $table) {
          $table->id();
          $table->string('name');
          $table->string('email');
          $table->text('message');
          $table->ipAddress('ip')->nullable();
          $table->timestamps();
      });
      

Sequencing

  1. Prerequisites:
    • Upgrade Laravel/Livewire to meet requirements (PHP 8.2+, Laravel 12+, Livewire 4).
    • Set up mail/webhook infrastructure (e.g., test SMTP, validate webhook endpoints).
  2. Core Integration:
    • Publish and configure config/contactable.php.
    • Create a Livewire component to render the form (e.g., resources/views/contact.blade.php):
      @livewire('contact-form')
      
    • Define the Livewire component (if extending functionality):
      namespace App\Livewire;
      use Labrodev\Contactable\ContactForm;
      class ContactForm extends ContactForm {}
      
  3. Testing:
    • Validate form submission, validation errors, and notification delivery.
    • Test edge cases (e.g., empty fields, malformed webhook payloads).
  4. Deployment:
    • Roll out to a subset of users (e.g., via feature flags) to monitor performance.
    • Monitor logs for notification failures (e.g., horizon:logs for queued jobs).

Operational Impact

Maintenance

  • Pros:
    • Centralized Configuration: Changes to form fields/validation/rules require updates to config/contactable.php only.
    • Decoupled Notifications: Adding a new channel (e.g., Slack) only requires extending the notify config or creating a custom channel.
    • MIT License: No vendor lock-in; can fork or modify the package if needed.
  • Cons:
    • Package Maturity: Low stars/commits suggest limited community support; issues may require internal fixes.
    • Livewire Updates: Future Livewire 4.x updates could introduce breaking changes (monitor labrodev/contactable for compatibility).
    • Configuration Drift: Multiple environments (dev/staging/prod) may require syncing config/contactable.php or using environment-specific configs.

Support

  • Troubleshooting:
    • Form Submission Issues:
      • Check Livewire logs (storage/logs/livewire.log) for component errors.
      • Validate CSRF tokens and session state.
    • Notification Failures:
      • For mail: Check Laravel mail logs (storage/logs/laravel.log) and test SMTP.
      • For webhooks: Verify endpoint URLs, SSL certificates, and payload formats.
      • For logs: Ensure log paths are writable and monitored.
    • Validation Errors: Debug field rules in config/contactable.php or extend with custom FormRequest validation.
  • Documentation:
    • Internal Runbook: Document common issues (e.g., "Webhook timeouts after 5 minutes") and resolutions.
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.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle