PHPackages                             shaffe/laravel-mail-log-channel - 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. shaffe/laravel-mail-log-channel

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

shaffe/laravel-mail-log-channel
===============================

A package to support logging via email in Laravel

v3.0.2(1mo ago)1286.2k↑20.8%1MITPHPPHP ^8.1

Since Sep 4Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/shaffe-fr/laravel-mail-log-channel)[ Packagist](https://packagist.org/packages/shaffe/laravel-mail-log-channel)[ Docs](https://github.com/shaffe-fr/laravel-mail-log-channel)[ RSS](/packages/shaffe-laravel-mail-log-channel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (14)Versions (17)Used By (0)

Laravel Mail Log Channel
========================

[](#laravel-mail-log-channel)

[![Latest Stable Version](https://camo.githubusercontent.com/685a3aa0845bf4c743de0dd34cbe858ae9c79f107627b025916fe59c00dfadf0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7368616666652d66722f6c61726176656c2d6d61696c2d6c6f672d6368616e6e656c2e737667)](https://packagist.org/packages/shaffe/laravel-mail-log-channel) [![Total Downloads](https://camo.githubusercontent.com/2a43a57a83ea839ee5b7850c08ea431bc18288e1dbe50c3defd6b57d376a9c1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368616666652f6c61726176656c2d6d61696c2d6c6f672d6368616e6e656c2e737667)](https://packagist.org/packages/shaffe/laravel-mail-log-channel)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

A service provider to add support for logging via email using Laravels built-in mail provider.

This package is a fork of [laravel-log-mailer](https://packagist.org/packages/designmynight/laravel-log-mailer) by Steve Porter.

Features
--------

[](#features)

- Structured error emails with clear sections
- Execution context: HTTP request (method, URL, route, controller, user), Artisan command, or Queue job (connection, queue)
- Environment badges: app environment, Laravel/PHP versions, server hostname
- Code snippet with error line highlighted
- Smart stack trace: application frames visible, vendor frames collapsed
- SQL queries with bindings and execution time
- Additional context from `Exception::context()` and log record
- Relative file paths for readability
- Previous exception chain display
- Clickable file paths to open directly in your editor (via `app.editor` config)

📸 See an example email[![screenshot](docs/screenshot.png)](docs/screenshot.png)

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [SQL Query Logging](#sql-query-logging)
- [Editor Links](#editor-links)
- [Upgrading](#upgrading)

Installation
------------

[](#installation)

You can install this package via composer using this commande:

```
composer require shaffe/laravel-mail-log-channel
```

### Laravel version compatibility

[](#laravel-version-compatibility)

LaravelPackage10, 11, 12, 13^3.05.6, 6, 7, 8, 9, 10, 11, 12, 13^2.05.6.x^1.0The package will automatically register itself.

Configuration
-------------

[](#configuration)

To ensure all unhandled exceptions are mailed:

1. create a `mail` logging channel in `config/logging.php`,
2. add this `mail` channel to your current logging stack,
3. add a `LOG_MAIL_ADDRESS` to your `.env` file to define the recipient.

You can specify multiple channels and individually change the recipients, the subject and the email template.

```
'channels' => [
    'stack' => [
        'driver' => 'stack',
        // 2. Add mail to the stack:
        'channels' => ['single', 'mail'],
    ],

    // ...

    // 1. Create a mail logging channel:
    'mail' => [
        'driver' => 'mail',
        'level' => env('LOG_MAIL_LEVEL', 'notice'),

        // Specify mail recipient
        'to' => [
            [
                'address' => env('LOG_MAIL_ADDRESS'),
                'name' => 'Error',
            ],
        ],

        'from' => [
            // Defaults to config('mail.from.address')
            'address' => env('LOG_MAIL_ADDRESS'),
            // Defaults to config('mail.from.name')
            'name' => 'Errors'
        ],

        // Show all vendor frames in stack trace (collapsed by default)
        // 'collapse_vendor_frames' => true,

        // Disable SQL query collection in error emails
        // 'log_queries' => false,

        // Optionally overwrite the subject format pattern
        // Available placeholders: %level_name%, %message%, %env%, %context%, %app_name%, %channel%, %datetime%
        // 'subject_format' => '[%level_name%] [%env%] %context% — %message%',

        // Optionally overwrite the mailable template
        // Two variables are sent to the view: `string $content` and `array $records`
        // 'mailable' => NewLogMailable::class
    ],
],
```

### Recipients configuration format

[](#recipients-configuration-format)

The following `to` config formats are supported:

- single email address:

    ```
    'to' => env('LOG_MAIL_ADDRESS', ''),
    ```
- array of email addresses:

    ```
    'to' => explode(',', env('LOG_MAIL_ADDRESS', '')),
    ```
- associative array of email =&gt; name addresses:

    ```
    'to' => [env('LOG_MAIL_ADDRESS', '') => 'Error'],`
    ```
- array of email and name:

    ```
    'to' => [
         [
             'address' => env('LOG_MAIL_ADDRESS', ''),
             'name' => 'Error',
         ],
     ],
    ```

SQL Query Logging
-----------------

[](#sql-query-logging)

The last 10 SQL queries (with bindings and execution time) are automatically included in error emails.

To disable it:

```
'mail' => [
    'driver' => 'mail',
    'log_queries' => false,
    // ...
],
```

Editor Links
------------

[](#editor-links)

File paths in error emails are clickable if you have configured the `app.editor` option in your Laravel application. Clicking a link will open the file at the correct line in your editor.

Laravel supports this natively since v9. Set it in `config/app.php`:

```
'editor' => 'phpstorm',
```

Or via environment variable:

```
APP_EDITOR=phpstorm
```

Supported editors: `phpstorm`, `vscode`, `vscode-insiders`, `cursor`, `sublime`, `textmate`, `atom`, `nova`, `idea`.

You can also use a custom URL scheme:

```
'editor' => [
    'href' => 'custom://open?file={file}&line={line}',
],
```

For remote servers where file paths differ from your local machine, use `base_path` to remap:

```
'editor' => [
    'name' => 'phpstorm',
    'base_path' => '/local/path/to/project',
],
```

Upgrading
---------

[](#upgrading)

### From v2 to v3

[](#from-v2-to-v3)

v3 completely redesigns the email output. The HTML format has changed and the `HtmlFormatter::addRow()` method has been removed.

v3 requires PHP 8.1+ and Laravel 10+. For older versions, use v2.

If you extended `HtmlFormatter` or relied on the HTML structure for parsing/filtering, review the new output format. The configuration API is unchanged — no config changes needed.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 87.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 ~183 days

Recently: every ~98 days

Total

16

Last Release

55d ago

Major Versions

v1.0.2 → v2.0.02020-02-19

v2.6.0 → v3.0.02026-03-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69542006c81a06197d5a15f1b350392dad178d77eb2a900ba6c043fffedf44e?d=identicon)[shaffe](/maintainers/shaffe)

---

Top Contributors

[![shaffe-fr](https://avatars.githubusercontent.com/u/3834222?v=4)](https://github.com/shaffe-fr "shaffe-fr (21 commits)")[![dev-idsys-mi](https://avatars.githubusercontent.com/u/62592572?v=4)](https://github.com/dev-idsys-mi "dev-idsys-mi (1 commits)")[![jbeales](https://avatars.githubusercontent.com/u/104935?v=4)](https://github.com/jbeales "jbeales (1 commits)")[![u01jmg3](https://avatars.githubusercontent.com/u/1266205?v=4)](https://github.com/u01jmg3 "u01jmg3 (1 commits)")

---

Tags

laravellaravel-logginglaravelloggingmonologlaravel-log-mailerlaravel-mail-log-channelmail channelshaffe

### Embed Badge

![Health badge](/badges/shaffe-laravel-mail-log-channel/health.svg)

```
[![Health](https://phpackages.com/badges/shaffe-laravel-mail-log-channel/health.svg)](https://phpackages.com/packages/shaffe-laravel-mail-log-channel)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

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