PHPackages                             the-trybe/laravel-discord-alerts - 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. the-trybe/laravel-discord-alerts

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

the-trybe/laravel-discord-alerts
================================

Automatic Discord notifications for failed Laravel queue jobs via webhooks

v1.0.0(4mo ago)00MITPHPPHP ^8.1|^8.2|^8.3|^8.4

Since Dec 15Pushed 4mo agoCompare

[ Source](https://github.com/the-trybe/laravel-discord-alerts)[ Packagist](https://packagist.org/packages/the-trybe/laravel-discord-alerts)[ RSS](/packages/the-trybe-laravel-discord-alerts/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

Laravel Discord Alerts
======================

[](#laravel-discord-alerts)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0feab0a5c26da57e514f99bdc6722813ad4fad3332b3d44ec7dad7c23043798a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468652d74727962652f6c61726176656c2d646973636f72642d616c657274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/the-trybe/laravel-discord-alerts)[![Total Downloads](https://camo.githubusercontent.com/e742809b0bc0093f55a91932a8bdb381f903b3d898cc69fb0466b5b8e498f868/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468652d74727962652f6c61726176656c2d646973636f72642d616c657274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/the-trybe/laravel-discord-alerts)

Automatically send beautiful Discord notifications when your Laravel queue jobs fail. Zero configuration needed beyond the webhook URL!

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

[](#installation)

Install via Composer:

```
composer require the-trybe/laravel-discord-alerts
```

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

[](#configuration)

### 1. Create a Discord Webhook

[](#1-create-a-discord-webhook)

1. Open your Discord server
2. Go to **Server Settings** → **Integrations** → **Webhooks**
3. Click **New Webhook**
4. Name it (e.g., "Laravel Alerts" or whatever~)
5. Select the channel where alerts should be posted
6. Copy the **Webhook URL**

### 2. Add Webhook URL to Environment

[](#2-add-webhook-url-to-environment)

Add to your `.env` file:

```
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz
DISCORD_ALERTS_ENABLED=true
```

### 3. Done!

[](#3-done)

That's it! The package will automatically send Discord alerts when any queue job fails.

Advanced Configuration
----------------------

[](#advanced-configuration)

Publish the configuration file (optional):

```
php artisan vendor:publish --tag=discord-alerts-config
```

This creates `config/discord-alerts.php` with the following options:

```
return [
    // Enable/disable alerts
    'enabled' => env('DISCORD_ALERTS_ENABLED', true),

    // Your Discord webhook URL
    'webhook_url' => env('DISCORD_WEBHOOK_URL'),

    // Include full stack trace (useful for debugging)
    'include_stack_trace' => env('DISCORD_INCLUDE_STACK_TRACE', false),

    // Include job payload/properties
    'include_payload' => env('DISCORD_INCLUDE_PAYLOAD', true),

    // Maximum payload length (prevents message overflow)
    'max_payload_length' => env('DISCORD_MAX_PAYLOAD_LENGTH', 500),
];
```

### Environment Variables

[](#environment-variables)

All available environment variables:

```
# Required
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

# Optional
DISCORD_ALERTS_ENABLED=true                # Enable/disable alerts (default: true)
DISCORD_INCLUDE_STACK_TRACE=false          # Include stack trace (default: false)
DISCORD_INCLUDE_PAYLOAD=true               # Include job data (default: true)
DISCORD_MAX_PAYLOAD_LENGTH=500             # Max payload chars (default: 500)
```

Usage Examples
--------------

[](#usage-examples)

### Basic Usage

[](#basic-usage)

No code changes needed! Just dispatch your jobs as usual:

```
use App\Jobs\ProcessPodcast;

// Dispatch job normally
ProcessPodcast::dispatch($podcast);

// If the job fails, you'll automatically get a Discord alert
```

What Information is Included?
-----------------------------

[](#what-information-is-included)

Each Discord alert includes:

### Always Included:

[](#always-included)

- **Job Class** - Full class name of the failed job
- **Error Message** - Exception message
- **Attempts** - Number of times job was attempted
- **Environment** - production/staging/local
- **Timestamp** - When the failure occurred
- **Queue Name** - Which queue the job was on
- **Connection** - Queue connection (redis, database, etc.)
- **Server** - Hostname or app URL
- **Exception Type** - Class name of the exception
- **Location** - File and line where error occurred

### Optional (Configurable):

[](#optional-configurable)

- **Job Payload** - Job properties and data
- **Stack Trace** - Full exception stack trace

Environment-Based Colors
------------------------

[](#environment-based-colors)

Alerts are color-coded based on environment:

- **Production** - Red (critical)
- **Staging** - Orange (warning)
- **Local/Other** - Yellow (info)

Troubleshooting
---------------

[](#troubleshooting)

### Not Receiving Alerts?

[](#not-receiving-alerts)

1. **Check webhook URL is set:**

    ```
    php artisan config:clear
    php artisan tinker
    >>> config('discord-alerts.webhook_url')
    ```
2. **Check alerts are enabled:**

    ```
    >>> config('discord-alerts.enabled')
    ```
3. **Check Laravel logs** for any errors:

    ```
    tail -f storage/logs/laravel.log
    ```
4. **Test the webhook directly:**

    ```
    curl -X POST "YOUR_WEBHOOK_URL" \
      -H "Content-Type: application/json" \
      -d '{"content": "Test message from Laravel"}'
    ```

License
-------

[](#license)

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

Credits
-------

[](#credits)

- [The Trybe Agency](https://github.com/the-trybe)
- [All Contributors](../../contributors)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance74

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

148d ago

### Community

Maintainers

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

---

Top Contributors

[![wanisramdani](https://avatars.githubusercontent.com/u/34271234?v=4)](https://github.com/wanisramdani "wanisramdani (2 commits)")

---

Tags

laravelmonitoringnotificationsqueuewebhooksalertsdiscorderror-trackingjob-failures

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/the-trybe-laravel-discord-alerts/health.svg)

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

PHPackages © 2026

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