PHPackages                             hugomyb/filament-error-mailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. hugomyb/filament-error-mailer

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

hugomyb/filament-error-mailer
=============================

Filament plugin for instant e-mail alerts on web errors, simplifying monitoring and application stability.

v5.1.0.0(3mo ago)1110.3k↓30%6MITPHPPHP ^8.1CI failing

Since Mar 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/hugomyb/filament-error-mailer)[ Packagist](https://packagist.org/packages/hugomyb/filament-error-mailer)[ Docs](https://github.com/hugomyb/filament-error-mailer)[ GitHub Sponsors](https://github.com/hugomyb)[ RSS](/packages/hugomyb-filament-error-mailer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (14)Used By (0)

Filament Error Mailer 🚨
=======================

[](#filament-error-mailer-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a67568b3d037de321326c7ea445274bd91c8b6ed85850ca9c58a2fb77b2e4ae9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6875676f6d79622f66696c616d656e742d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hugomyb/filament-error-mailer)[![Total Downloads](https://camo.githubusercontent.com/ae3698c16d3f48c7b613ffaa3802d84c1dbefe03ae92ae2be27b3c07d5bf2e54/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875676f6d79622f66696c616d656e742d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hugomyb/filament-error-mailer)

A powerful Filament plugin that provides instant error notifications via email and Discord webhooks, with a beautiful error details page for debugging. Never miss a critical error in your application again!

✨ Key Features
--------------

[](#-key-features)

- 📧 **Instant Email Notifications** - Get notified immediately when errors occur
- 💬 **Discord Webhook Integration** - Send alerts to your Discord channels
- 🎯 **Smart Application File Detection** - Automatically identifies errors in your code (excluding vendor files)
- 🌓 **Beautiful Error Details Page** - Dark/Light mode with copy &amp; share functionality
- ⏱️ **Cooldown System** - Prevents notification spam for duplicate errors
- 🎛️ **Advanced Filtering** - Filter by log level, exception type, or environment
- 🔒 **Secure Access** - Protected by Filament authentication
- 📦 **JSON Storage** - All errors stored as JSON files for easy access

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
    - [Email Configuration](#email-configuration)
    - [Discord Webhook](#discord-webhook)
    - [Error Filtering](#error-filtering)
    - [Cooldown Period](#cooldown-period)
    - [Storage Path](#storage-path)
- [Features in Detail](#features-in-detail)
    - [Smart Application File Detection](#smart-application-file-detection)
    - [Error Details Page](#error-details-page)
    - [Notification Cooldown](#notification-cooldown)
- [Usage](#usage)
    - [Accessing Error Details](#accessing-error-details)
    - [Scheduled Cleanup](#scheduled-cleanup)
- [Advanced Configuration](#advanced-configuration)
- [Contributing](#contributing)
- [License](#license)

📦 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require hugomyb/filament-error-mailer
```

### Step 2: Publish Configuration

[](#step-2-publish-configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag="error-mailer-config"
```

This creates `config/error-mailer.php` with the following default configuration:

```
return [
    'email' => [
        'recipient' => ['recipient1@example.com'],
        'bcc' => [],
        'cc' => [],
        'subject' => 'An error has occurred - ' . config('app.name'),
    ],

    'disabledOn' => [
        //
    ],

    'cacheCooldown' => 10, // in minutes

    'webhooks' => [
        'discord' => env('ERROR_MAILER_DISCORD_WEBHOOK'),

        'message' => [
            'title' => 'Error Alert - ' . config('app.name'),
            'description' => 'An error has occurred in the application.',
            'error' => 'Error',
            'file' => 'File',
            'line' => 'Line',
            'details_link' => 'See more details'
        ],
    ],

    'storage_path' => storage_path('app/errors'),

    'ignore' => [
        'levels' => [
            // 'debug',
            // 'info',
        ],
        'exceptions' => [
            // \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
        ],
    ],
];
```

### Step 3: Configure Mail Server

[](#step-3-configure-mail-server)

> ⚠️ **IMPORTANT**: Configure your mail server in `.env` to receive email notifications:

```
MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host.com
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourapp.com
MAIL_FROM_NAME="${APP_NAME}"
```

### Step 4: Register the Plugin

[](#step-4-register-the-plugin)

Add the plugin to your Filament panel provider (e.g., `app/Providers/Filament/AdminPanelProvider.php`):

```
use Hugomyb\FilamentErrorMailer\FilamentErrorMailerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugins([
            FilamentErrorMailerPlugin::make(),
        ]);
}
```

### Step 5: (Optional) Publish Views

[](#step-5-optional-publish-views)

If you want to customize the error details page or email template:

```
php artisan vendor:publish --tag="error-mailer-views"
```

---

⚙️ Configuration
----------------

[](#️-configuration)

### Email Configuration

[](#email-configuration)

Configure email recipients and subject in `config/error-mailer.php`:

```
'email' => [
    'recipient' => ['admin@example.com', 'dev@example.com'],
    'bcc' => ['monitoring@example.com'],
    'cc' => [],
    'subject' => 'Error Alert - ' . config('app.name'),
],
```

**Options:**

- `recipient` (array): Primary email addresses to receive notifications
- `bcc` (array): Blind carbon copy recipients
- `cc` (array): Carbon copy recipients
- `subject` (string): Email subject line (supports dynamic values)

### Discord Webhook

[](#discord-webhook)

Send error notifications to Discord channels:

**1. Create a Discord Webhook:**

- Go to your Discord server settings
- Navigate to Integrations → Webhooks
- Click "New Webhook"
- Copy the webhook URL

**2. Add to `.env`:**

```
ERROR_MAILER_DISCORD_WEBHOOK="https://discord.com/api/webhooks/your-webhook-id/your-webhook-token"
```

**3. Customize webhook messages (optional):**

```
'webhooks' => [
    'discord' => env('ERROR_MAILER_DISCORD_WEBHOOK'),

    'message' => [
        'title' => 'Error Alert - ' . config('app.name'),
        'description' => 'An error has occurred in the application.',
        'error' => 'Error',
        'file' => 'File',
        'line' => 'Line',
        'details_link' => 'View Details',
    ],
],
```

### Error Filtering

[](#error-filtering)

Control which errors trigger notifications:

```
'ignore' => [
    // Ignore specific log levels
    'levels' => [
        'debug',
        'info',
        // 'warning',
        // 'error',
    ],

    // Ignore specific exception types
    'exceptions' => [
        \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
        \Illuminate\Validation\ValidationException::class,
        \Illuminate\Auth\AuthenticationException::class,
    ],
],
```

**Available log levels:**

- `debug` - Detailed debug information
- `info` - Interesting events
- `notice` - Normal but significant events
- `warning` - Exceptional occurrences that are not errors
- `error` - Runtime errors
- `critical` - Critical conditions
- `alert` - Action must be taken immediately
- `emergency` - System is unusable

### Disable in Specific Environments

[](#disable-in-specific-environments)

Prevent notifications in certain environments (e.g., local development):

```
'disabledOn' => [
    'local',
    'testing',
],
```

### Cooldown Period

[](#cooldown-period)

Prevent notification spam for duplicate errors:

```
'cacheCooldown' => 10, // in minutes
```

If the same error occurs multiple times within this period, only the first occurrence will trigger a notification.

### Storage Path

[](#storage-path)

Customize where error JSON files are stored:

```
'storage_path' => storage_path('app/errors'),
```

---

🎯 Features in Detail
--------------------

[](#-features-in-detail)

### Smart Application File Detection

[](#smart-application-file-detection)

When an error occurs, the package intelligently identifies the **first line of code from your application** (excluding vendor files) in the stack trace.

**Example:**

Instead of showing:

```
File: /vendor/laravel/framework/src/Illuminate/Database/Connection.php
Line: 742

```

You'll see:

```
Application File: /app/Http/Controllers/UserController.php  ← Your code!
Application Line: 25                                         ← Your code!
Origin File: /vendor/laravel/framework/src/Illuminate/Database/Connection.php
Origin Line: 742

```

This makes debugging **significantly faster** by immediately showing you where in **your code** the error originated.

### Error Details Page

[](#error-details-page)

Each error notification includes a unique link to a beautiful, feature-rich error details page:

**Features:**

- 🌓 **Dark/Light Mode** - Toggle themes with persistent preference (saved in localStorage)
- 📋 **Copy as Markdown** - Copy formatted error details for documentation
- 📄 **Copy as JSON** - Copy raw error data for processing
- 🔗 **Share** - Use native Web Share API (mobile-friendly)
- 🔒 **Secure** - Protected by Filament authentication
- 📱 **Responsive** - Works perfectly on all devices

**Information displayed:**

- Error message and exception type
- Application file and line (your code)
- Origin file and line (where exception was thrown)
- Full stack trace
- Request details (method, URL, IP, user agent, referrer)
- Authenticated user information (if available)
- Timestamp

**Access:** Only authenticated Filament users can view error details.

### Notification Cooldown

[](#notification-cooldown)

The cooldown system prevents notification spam:

1. When an error occurs, a notification is sent
2. Error details are stored with a timestamp
3. If the same error occurs again within the cooldown period, no new notification is sent
4. After the cooldown expires, the next occurrence will trigger a new notification

**Error identification:** Errors are identified by a hash of the error message and file path.

---

🚀 Usage
-------

[](#-usage)

### Accessing Error Details

[](#accessing-error-details)

Error detail links are automatically included in:

- Email notifications
- Discord webhook messages

**URL format:** `https://yourapp.com/error-mailer/{errorId}`

**Example email:**

```
Subject: Error Alert - MyApp

An error has occurred:
Message: Call to undefined method...
File: /app/Http/Controllers/UserController.php
Line: 25

View full details: https://yourapp.com/error-mailer/abc123def456

```

### Scheduled Cleanup

[](#scheduled-cleanup)

Error JSON files are stored indefinitely by default. To prevent excessive storage usage, schedule a cleanup task in `app/Console/Kernel.php`:

```
protected function schedule(Schedule $schedule)
{
    // Delete errors older than 3 months
    $schedule->call(function () {
        $storagePath = config('error-mailer.storage_path');
        $files = File::files($storagePath);

        foreach ($files as $file) {
            if ($file->getMTime() < now()->subMonths(3)->timestamp) {
                File::delete($file->getRealPath());
            }
        }
    })->daily();
}
```

**Recommended retention periods:**

- Production: 3-6 months
- Staging: 1-3 months
- Development: 1 month

---

🔧 Advanced Configuration
------------------------

[](#-advanced-configuration)

### Complete Configuration Reference

[](#complete-configuration-reference)

```
return [
    // Email notification settings
    'email' => [
        'recipient' => ['admin@example.com'],
        'bcc' => [],
        'cc' => [],
        'subject' => 'Error Alert - ' . config('app.name'),
    ],

    // Environments where notifications are disabled
    'disabledOn' => [
        // 'local',
        // 'testing',
    ],

    // Cooldown period in minutes
    'cacheCooldown' => 10,

    // Webhook configuration
    'webhooks' => [
        'discord' => env('ERROR_MAILER_DISCORD_WEBHOOK'),

        'message' => [
            'title' => 'Error Alert - ' . config('app.name'),
            'description' => 'An error has occurred in the application.',
            'error' => 'Error',
            'file' => 'File',
            'line' => 'Line',
            'details_link' => 'View Details',
        ],
    ],

    // Storage path for error JSON files
    'storage_path' => storage_path('app/errors'),

    // Error filtering
    'ignore' => [
        'levels' => [
            // 'debug',
            // 'info',
        ],
        'exceptions' => [
            // \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
        ],
    ],
];
```

---

📚 Related Projects
------------------

[](#-related-projects)

This plugin is also available for **Laravel projects without Filament**:

👉 **[Laravel Error Mailer](https://github.com/hugomayo7/LaravelErrorMailer)**

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

### Development Setup

[](#development-setup)

```
# Clone the repository
git clone https://github.com/hugomyb/filament-error-mailer.git
cd filament-error-mailer

# Install dependencies
composer install

# Run tests
composer test

# Run tests with coverage
composer test-coverage
```

### Running Tests

[](#running-tests)

```
# Run all tests
vendor/bin/pest

# Run specific test file
vendor/bin/pest tests/Unit/ErrorDetailsBuilderTest.php

# Run with coverage
vendor/bin/pest --coverage
```

---

🔒 Security Vulnerabilities
--------------------------

[](#-security-vulnerabilities)

If you discover a security vulnerability, please send an email to . All security vulnerabilities will be promptly addressed.

Please review [our security policy](../../security/policy) for more information.

---

👥 Credits
---------

[](#-credits)

- [Hugo Mayonobe](https://github.com/hugomyb) - Creator &amp; Maintainer
- [All Contributors](../../contributors)

---

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

💡 Support
---------

[](#-support)

If you find this package helpful, please consider:

- ⭐ Starring the repository
- 🐛 Reporting bugs or suggesting features via [GitHub Issues](https://github.com/hugomyb/filament-error-mailer/issues)
- 📖 Improving documentation via pull requests

---

**Made with ❤️ for the Filament community**

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance79

Regular maintenance activity

Popularity34

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~42 days

Total

13

Last Release

108d ago

Major Versions

v3.2.0.3 → v4.0.0.02025-08-14

v4.0.0.2 → v5.0.0.02026-01-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/65a12f2e3c6b262cd42d0ebf14525f0c6066aa6563cd3ff06034e85f931c9c54?d=identicon)[hugomyb](/maintainers/hugomyb)

---

Top Contributors

[![hugomyb](https://avatars.githubusercontent.com/u/92823242?v=4)](https://github.com/hugomyb "hugomyb (21 commits)")[![agencetwogether](https://avatars.githubusercontent.com/u/53862310?v=4)](https://github.com/agencetwogether "agencetwogether (2 commits)")[![maximemolivier](https://avatars.githubusercontent.com/u/82213369?v=4)](https://github.com/maximemolivier "maximemolivier (1 commits)")[![underdpt](https://avatars.githubusercontent.com/u/8122137?v=4)](https://github.com/underdpt "underdpt (1 commits)")

---

Tags

laravelhugomybfilament-error-mailer

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hugomyb-filament-error-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/hugomyb-filament-error-mailer/health.svg)](https://phpackages.com/packages/hugomyb-filament-error-mailer)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[spatie/laravel-slack-alerts

Send a message to Slack

3212.6M4](/packages/spatie-laravel-slack-alerts)[dotswan/filament-laravel-pulse

82137.2k1](/packages/dotswan-filament-laravel-pulse)[tapp/filament-maillog

Filament plugin to view outgoing mail

2952.6k1](/packages/tapp-filament-maillog)[spatie/laravel-error-share

Share your Laravel errors to Flare

43965.6k3](/packages/spatie-laravel-error-share)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
