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

Fin Mail Laravel Package

finity-labs/fin-mail

FinMail adds an email template manager and composer to Filament. Create dynamic, multilingual templates with token replacement and merge tags, version templates, log sent emails with status tracking, override auth mails, and use a reusable “Send Email” action in resources.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Filament Integration: Designed natively for Filament (v4/v5), aligning with its plugin system, resource architecture, and UI components. Leverages Filament’s Panel, Resource, and Action systems, reducing friction for teams already using Filament.
  • Laravel Ecosystem: Built on Laravel’s core features (Mailables, Queues, Events, Blade) with minimal abstraction overhead. Compatible with Laravel’s email drivers (Mailgun, SES, etc.) and queue systems (Redis, database).
  • Modularity: Plugin-based design allows selective adoption (e.g., disable themes, logging, or Shield integration). Core features (templates, tokens) are decoupled from optional modules.
  • Event-Driven: Extensible via Laravel events (EmailSent, EmailFailed), enabling integration with analytics, CRM systems, or custom workflows without modifying FinMail’s codebase.

Integration Feasibility

  • Low Coupling: No forced dependencies beyond Filament/Laravel. Uses spatie/laravel-settings for config (auto-installed) but can be replaced with custom storage.
  • Blade Compatibility: Templates use standard Blade syntax with FinMail-specific tokens ({{ user.name }}). Existing Blade views can coexist if wrapped in TemplateMail.
  • Queue Support: Emails are queued by default (configurable connection/name), aligning with Laravel’s async best practices.
  • Database Schema: Publishes migrations for templates, logs, and settings. Minimal schema changes required if using default tables.

Technical Risk

  • Filament Version Lock: Hard dependency on Filament 4/5. Upgrades may require testing if Filament evolves its plugin system (e.g., resource registration APIs).
  • Token System Complexity: Dynamic tokens ({{ user.name }}) and conditionals ({% if %}) add runtime parsing overhead. Edge cases (e.g., circular relations, malformed tokens) may need custom validation.
  • Editor Dependencies: RichEditor/Tiptap/TinyMCE must be configured. Custom blocks require implementing RichContentCustomBlock, which may introduce frontend complexity.
  • Performance: Email logging stores rendered bodies (potentially large). Scheduled cleanup is recommended for long-term use.
  • Localization: Relies on spatie/laravel-translatable. Projects with non-standard localization setups may need adjustments.

Key Questions

  1. Filament Adoption: Is Filament already used in the stack? If not, evaluate the cost of adopting it for admin panels.
  2. Token Requirements: Does the project need advanced token features (e.g., conditionals, fallbacks)? If not, simpler solutions (e.g., manual Blade views) may suffice.
  3. Scaling Needs: Will email volume require custom queue workers or rate limiting? FinMail’s default queue system may need tuning.
  4. Customization Depth: Are custom blocks or editor plugins needed? This increases frontend complexity.
  5. Compliance: Does email logging/storage meet regulatory requirements (e.g., GDPR)? FinMail’s default logging may need extension.
  6. Theme System: Is the theme/color customization feature critical, or can static templates suffice?
  7. Shield Integration: Is Filament Shield used? If not, the built-in permissions may be unnecessary overhead.

Integration Approach

Stack Fit

  • Laravel 11/12/13: Native support with no breaking changes. PHP 8.2+ ensures modern features (e.g., enums, attributes).
  • Filament 4/5: Primary target. Teams using Filament will see seamless integration; others may need to adopt Filament for the admin panel.
  • Frontend: Tailwind CSS for themes/editor. Custom blocks require JavaScript (Alpine.js/Vue for Filament’s RichEditor).
  • Database: MySQL/PostgreSQL (default). No vendor-specific features.
  • Queue: Supports Laravel’s queue system (Redis, database, etc.). Async sending is built-in.

Migration Path

  1. Evaluation Phase:
    • Install in a staging environment: composer require finity-labs/fin-mail.
    • Run php artisan fin-mail:install with --dry-run (if supported) or review published migrations.
    • Test token replacement with a sample template and model.
  2. Pilot Integration:
    • Migrate 1–2 critical email templates (e.g., password resets, invoices) to FinMail’s system.
    • Compare performance (rendering time, queue processing) against existing solutions.
  3. Full Adoption:
    • Replace custom Mailable classes with TemplateMail.
    • Migrate existing Blade templates to FinMail’s editor (or use php artisan fin-mail:seed for defaults).
    • Update Filament resources to use SendEmailAction and SentEmailsRelationManager.
  4. Deprecation:
    • Phase out legacy email logic (e.g., manual Mail::send() calls).
    • Redirect old template references to FinMail’s UI.

Compatibility

  • Existing Templates: Convert Blade templates to FinMail’s editor by:
    • Copying content to the RichEditor.
    • Replacing hardcoded values with tokens (e.g., {{ user.name }}).
    • Using TemplateMail::make()->with() for non-token data.
  • Custom Mailables: Replace with TemplateMail:
    // Before
    Mail::to($user)->send(new WelcomeEmail($user));
    
    // After
    Mail::to($user)->send(TemplateMail::make('welcome-email')->models(['user' => $user]));
    
  • Third-Party Packages: Conflicts possible with spatie/laravel-settings or filament-shield. Resolve via Composer’s --with-all-dependencies or manual config overrides.
  • Legacy Systems: Use events (EmailSent) to sync with external systems (e.g., CRM, analytics).

Sequencing

  1. Setup:
    • Install FinMail and publish assets (php artisan vendor:publish --tag=fin-mail-views).
    • Configure config/fin-mail.php (queues, locales, branding).
  2. Template Migration:
    • Seed default templates or import existing ones via the UI.
    • Test token replacement with sample data.
  3. Resource Integration:
    • Add SendEmailAction to Filament resources.
    • Attach SentEmailsRelationManager to models needing email history.
  4. Customization:
    • Extend with custom blocks or themes if needed.
    • Register event listeners for post-send logic.
  5. Deployment:
    • Roll out in phases (e.g., non-critical emails first).
    • Monitor queue performance and logging overhead.

Operational Impact

Maintenance

  • Updates: FinMail follows Laravel/Filament’s release cycles. Minor updates are low-risk; major versions may require testing.
  • Dependencies: spatie/laravel-settings and Filament plugins are managed automatically. Monitor for breaking changes in these packages.
  • Template Management: Centralized UI reduces maintenance burden for email templates (no scattered Blade files).
  • Logging: Sent emails are stored in the database. Implement cleanup jobs (e.g., php artisan fin-mail:prune-emails) for long-term use.

Support

  • Troubleshooting:
    • Use php artisan fin-mail:test to validate template rendering.
    • Check sent_emails table for failed sends (status = failed).
    • Debug token issues with {{ token | debug }} in templates.
  • Common Issues:
    • Token parsing errors (e.g., missing relations). Validate models passed to TemplateMail.
    • Queue deadlocks. Monitor failed_jobs table and adjust queue workers.
    • Editor conflicts. Ensure custom blocks implement all required methods.
  • Documentation: README and changelog are comprehensive. Community support is limited (low stars/dependents); expect self-service for edge cases.

Scaling

  • Performance:
    • Rendering: Token replacement is O(n) per email. Cache rendered templates if using static content.
    • Queue: Default queue system scales horizontally. Consider dedicated workers for high-volume sends.
    • Database: Logging sent emails adds I/O. Index sent_emails(recipient, status) for queries.
  • Horizontal Scaling: Stateless design (except logging) allows scaling Laravel workers independently.
  • Cold Starts: Queued emails mitigate latency. Use Mail::later() for time-sensitive sends.

Failure Modes

Scenario Impact Mitigation
Database downtime Emails not logged Use EmailFailed event to retry or notify admins.
Queue worker crash Emails delayed Monitor queue backlog; scale workers.
Template token errors Rendering failures Validate models before sending; use fallbacks ({{ user.name | 'Guest' }}).
Editor JS failures UI broken Provide fallback Blade templates.
Storage limits Logs fill disk Schedule cleanup (fin-mail:prune-emails).
Filament plugin conflict Admin panel broken Isolate FinMail in a separate panel or test in staging.

Ramp-Up

  • Developer Onboarding:
    • 1–2 Days: Learn
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope