PHPackages                             jeffersongoncalves/laravel-discord-logger - 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. jeffersongoncalves/laravel-discord-logger

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

jeffersongoncalves/laravel-discord-logger
=========================================

Send Laravel logs to Discord with deduplication, configurable error grouping, rate limiting, async delivery and a graceful no-op when the webhook URL is missing.

20PHPCI passing

Since Jun 22Pushed today1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-discord-logger)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-discord-logger)[ RSS](/packages/jeffersongoncalves-laravel-discord-logger/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (1)Used By (0)

[![Laravel Discord Logger](https://raw.githubusercontent.com/jeffersongoncalves/laravel-discord-logger/master/art/jeffersongoncalves-laravel-discord-logger.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-discord-logger/master/art/jeffersongoncalves-laravel-discord-logger.png)

Laravel Discord Logger
======================

[](#laravel-discord-logger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f3d5c15be52df4138d7f069eb5106617f242ce0952c33d480f71dd22815d69c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d646973636f72642d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-discord-logger)[![Tests](https://camo.githubusercontent.com/25627cd05f0b81528451d6c83aaa1833ef346bbb1984c0ab645b1ab9989af503/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d646973636f72642d6c6f676765722f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-discord-logger/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/6b51e9bc0c9cbf17a4989019e0b6fd789cd2a4a66055014490aa4bfa13e1f41a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d646973636f72642d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-discord-logger)[![License](https://camo.githubusercontent.com/86306536a7b89f90f12f4d8826901725dc420479ed36e5657c538d9f44b566cf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d646973636f72642d6c6f676765723f7374796c653d666c61742d737175617265)](LICENSE.md)

Send Laravel logs to Discord — built for production. A Monolog channel with **deduplication**, **configurable error grouping**, **rate limiting**, **async delivery** with 429 backoff, and a **graceful no-op** when the webhook URL is missing.

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

[](#installation)

```
composer require jeffersongoncalves/laravel-discord-logger
```

Publish the config (optional):

```
php artisan vendor:publish --tag="laravel-discord-logger-config"
```

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

[](#configuration)

Add a channel to `config/logging.php`:

```
'discord' => [
    'driver' => 'custom',
    'via'    => \JeffersonGoncalves\DiscordLogger\Logger::class,
    'level'  => env('LOG_DISCORD_LEVEL', 'error'),
    'url'    => env('LOG_DISCORD_WEBHOOK_URL'),
],
```

Stack it onto your default channel so errors fan out:

```
'stack' => [
    'driver'   => 'stack',
    'channels' => ['single', 'discord'],
    'ignore_exceptions' => false,
],
```

Set the webhook (leave empty in local/testing — nothing will be sent, nothing will break):

```
LOG_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/yyy
```

How the improvements work
-------------------------

[](#how-the-improvements-work)

### Error grouping (fingerprint)

[](#error-grouping-fingerprint)

`config/discord-logger.php` → `grouping.strategy`:

- `message` — group by message text
- `level_message` — group by level + message
- `exception` *(default)* — group by exception class + file + line
- a `callback` `fn (\Monolog\LogRecord $record): string` for full control

With `grouping.normalize` on, volatile tokens (numbers, UUIDs, hashes) are stripped before hashing, so `User 123 not found` and `User 456 not found` collapse together.

### Deduplication

[](#deduplication)

Within `deduplication.window` seconds, only the **first** occurrence of a fingerprint is sent. Repeats are counted silently. When the window closes, a single summary (`🔁 occurred N×`) is delivered — turn it off with `deduplication.summary => false`.

### Rate limiting

[](#rate-limiting)

- `rate_limit.global` — hard cap on total messages app-wide
- `rate_limit.per_fingerprint` — extra guard against a single looping error

### Async delivery

[](#async-delivery)

Delivery runs through a queued job by default (`queue.enabled`). Discord 429s are retried respecting `Retry-After`; bad webhooks (4xx) fail fast instead of looping. Set `queue.enabled => false` to send inline (best-effort, errors swallowed).

### State store

[](#state-store)

Dedup + rate-limit counters live in the cache store named by `store` (null = default). **Use Redis in production** for atomic counters.

### Per-level webhooks &amp; mentions

[](#per-level-webhooks--mentions)

Route a level to its own channel and ping someone when it matters:

```
'webhooks' => [
    'EMERGENCY' => env('DISCORD_LOGGER_WEBHOOK_ALERTS'),
    'CRITICAL'  => env('DISCORD_LOGGER_WEBHOOK_ALERTS'),
],

'mentions' => [
    'EMERGENCY' => '@here',
    'CRITICAL'  => '', // role id
],
```

`allowed_mentions` is set automatically, so `@here` / `@everyone` / role / user pings actually fire.

### Context redaction

[](#context-redaction)

Sensitive context keys are masked before sending — configure with `redact` (case-insensitive key fragments). Defaults cover `password`, `secret`, `token`, `authorization`, `api_key`.

### Fallback channel &amp; safety

[](#fallback-channel--safety)

The handler **never throws** and is guarded against logging-while-logging recursion. If delivery throws, the error is swallowed; set `fallback_channel` (e.g. `'single'`) to record those failures instead of losing them.

Commands
--------

[](#commands)

```
# Publish the config + optionally star the repo
php artisan discord-logger:install

# Send a test message to verify the webhook
php artisan discord-logger:test --channel=discord
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

Inspired by [`marvinlabs/laravel-discord-logger`](https://github.com/vpratfr/laravel-discord-logger).

License
-------

[](#license)

The MIT License (MIT). See [License File](LICENSE.md).

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance65

Regular maintenance activity

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411493?v=4)[Jefferson Gonçalves](/maintainers/jeffersongoncalves)[@jeffersongoncalves](https://github.com/jeffersongoncalves)

---

Top Contributors

[![jeffersongoncalves](https://avatars.githubusercontent.com/u/411493?v=4)](https://github.com/jeffersongoncalves "jeffersongoncalves (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

discordlaravelloggingmonologphpwebhook

### Embed Badge

![Health badge](/badges/jeffersongoncalves-laravel-discord-logger/health.svg)

```
[![Health](https://phpackages.com/badges/jeffersongoncalves-laravel-discord-logger/health.svg)](https://phpackages.com/packages/jeffersongoncalves-laravel-discord-logger)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B10.8k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1938.5M261](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M315](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)[relaxart/monolog-docker-handler

Docker handler for monolog

1442.6k](/packages/relaxart-monolog-docker-handler)

PHPackages © 2026

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