PHPackages                             artryazanov/laravel-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. artryazanov/laravel-error-mailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

artryazanov/laravel-error-mailer
================================

A Laravel package for sending detailed error information via email.

v1.1.1(1mo ago)1717↑18.8%MITPHPPHP ^8.2CI passing

Since Jul 13Pushed 1mo agoCompare

[ Source](https://github.com/artryazanov/laravel-error-mailer)[ Packagist](https://packagist.org/packages/artryazanov/laravel-error-mailer)[ RSS](/packages/artryazanov-laravel-error-mailer/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (6)Versions (11)Used By (0)

📧 Laravel Error Mailer
======================

[](#-laravel-error-mailer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e49af251f8bc6b736d3d33384cb5af6ae1d3838dc8ddd69fa256d1e2ef70b45f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/artryazanov/laravel-error-mailer)[![Tests](https://camo.githubusercontent.com/6ea516b73035a463e77e720d46e0a6d21345ceb2555455cd7855c7a340f509ab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/artryazanov/laravel-error-mailer/actions/workflows/tests.yml)[![Lint](https://camo.githubusercontent.com/04005360d0390d4807f3fc1076d1179b701b9956cdb8071d7f49fad9040c7d9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722f6c696e742e796d6c3f6272616e63683d6d61696e266c6162656c3d6c696e74267374796c653d666c61742d737175617265)](https://github.com/artryazanov/laravel-error-mailer/actions/workflows/lint.yml)[![Codecov](https://camo.githubusercontent.com/35b32a9202f5d68a5396fed207d36415876639cc5149234f42e375b4402d906f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/artryazanov/laravel-error-mailer)[![Total Downloads](https://camo.githubusercontent.com/5125eb2e51e529f3988a500ff01427e7c1fad931953bab0242c617e2074ab8f8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/artryazanov/laravel-error-mailer)[![License](https://camo.githubusercontent.com/7ccff469358e39dbe2f78519e9fbae2d6dbe6494fedd8b286a142d9f9d9cea0f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6172747279617a616e6f762f6c61726176656c2d6572726f722d6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/artryazanov/laravel-error-mailer/blob/main/LICENSE)

Laravel 11-13 package to automatically send detailed exception reports to configured email addresses. Features a clean HTML template that includes your application's name and environment, full stack traces, comprehensive context data, and built-in rate limiting to prevent spamming your inbox when your application throws repeated errors.

✨ Features
----------

[](#-features)

- **Clean HTML Template:** A clear and readable layout for error reporting.
- **Comprehensive Context Capture:**
    - **Web Requests:** URL, Method, User info, Request Body, Headers, Cookies, and `$_SERVER` array.
    - **Console Commands (CLI):** Command arguments and `$_SERVER` array.
- **Rate Limiting:** Protects your inbox from spam when a recurring error floods your application.
- **Smart Email Subjects:** The error message is automatically appended to the email subject line (and truncated if too long), making it easy to identify the error at a glance. An optional short hash can be enabled to group similar errors.
- **Previous Exceptions:** Automatically unwraps and displays previous exceptions in the chain.

📋 Requirements
--------------

[](#-requirements)

- PHP 8.2+
- Laravel 11.x–13.x

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

[](#-installation)

You can install the package via composer:

```
composer require artryazanov/laravel-error-mailer
```

Laravel auto-discovers the service provider. No manual registration is needed.

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

[](#️-configuration)

Publish the configuration and view files to customize them:

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

Configuration file: `config/error-mailer.php`

In your `.env` file, you can set the following variables:

```
ERROR_MAILER_ENABLED=true
ERROR_MAILER_FROM=error-mailer@example.com
ERROR_MAILER_TO=admin@example.com
ERROR_MAILER_CC=
ERROR_MAILER_BCC=
# Optional: Override the default subject "Error on {APP_NAME} ({APP_ENV})"
# The exact error message is automatically appended to the subject in either case.
ERROR_MAILER_SUBJECT="Error on production"

# Optional: Append a hash of the exception message to the subject (useful for email clients grouping). Defaults to false.
ERROR_MAILER_INCLUDE_HASH_IN_SUBJECT=false

# Rate limit: Max emails to send per time window (in seconds)
ERROR_MAILER_LIMIT=15
ERROR_MAILER_WINDOW=3600
```

💻 Usage
-------

[](#-usage)

### Laravel 11+

[](#laravel-11)

In newer Laravel versions, exception handling is configured in `bootstrap/app.php`. Add the explicit reporting callback inside your `withExceptions` method:

```
use Artryazanov\ErrorMailer\Facades\ErrorMailer;
use Illuminate\Foundation\Configuration\Exceptions;
use Throwable;

return Application::configure(basePath: dirname(__DIR__))
    // ...
    ->withExceptions(function (Exceptions $exceptions) {
        $exceptions->reportable(function (Throwable $e) {
            ErrorMailer::handle($e);
        });
    })->create();
```

### Older Laravel Versions (or custom Handlers)

[](#older-laravel-versions-or-custom-handlers)

If you are using `app/Exceptions/Handler.php`, you can call the facade in your `register` method:

```
use Artryazanov\ErrorMailer\Facades\ErrorMailer;
use Throwable;

public function register(): void
{
    $this->reportable(function (Throwable $e) {
        ErrorMailer::handle($e);
    });
}
```

🛡️ Rate Limiting
----------------

[](#️-rate-limiting)

If your application loses connection to a database or a critical service goes down, it might throw hundreds of exceptions per minute.

This package has built-in Rate Limiting to protect your inbox. By default, it allows sending **15 emails per hour**. Any exceptions thrown beyond this limit will be suppressed from the mailer (but a standard Laravel `Log::warning` will be recorded stating that the email was suppressed).

You can tweak the threshold in your `.env` using `ERROR_MAILER_LIMIT` and `ERROR_MAILER_WINDOW`.

🧪 Local Testing &amp; Preview
-----------------------------

[](#-local-testing--preview)

If you want to see exactly how the generated emails look without deploying to a live server, this package includes a convenient Docker-based preview script using [Mailpit](https://mailpit.axllent.org/).

1. Start the Mailpit Docker container: ```
    docker compose up -d
    ```
2. Run the preview script to simulate an exception and send the email: ```
    php preview-docker.php
    ```
3. Open your browser and navigate to **** to view the rendered HTML email in Mailpit's beautiful web interface.

🎨 Customizing the View
----------------------

[](#-customizing-the-view)

If you published the views, you can find the HTML email template in `resources/views/vendor/error-mailer/emails/exception.blade.php`. You can modify it to match your company's branding, adjust the layout, or include additional variables.

📄 License
---------

[](#-license)

This package is released under the MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.5% 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 ~0 days

Total

10

Last Release

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4519328?v=4)[Artem Ryazanov](/maintainers/artryazanov)[@artryazanov](https://github.com/artryazanov)

---

Top Contributors

[![artryazanov](https://avatars.githubusercontent.com/u/4519328?v=4)](https://github.com/artryazanov "artryazanov (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

emailemail-notificationserror-handlingerror-reportingexceptionslaravellaravel-packagemailerphp

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/artryazanov-laravel-error-mailer/health.svg)

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

###  Alternatives

[illuminate/notifications

The Illuminate Notifications package.

513.2M1.3k](/packages/illuminate-notifications)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k104.7M370](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

3.0k56.7M13.6k](/packages/illuminate-database)[propaganistas/laravel-disposable-email

Disposable email validator

6093.4M9](/packages/propaganistas-laravel-disposable-email)[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)

PHPackages © 2026

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