the-trybe/laravel-discord-alerts
Composer 安装命令:
composer require the-trybe/laravel-discord-alerts
包简介
Automatic Discord notifications for failed Laravel queue jobs via webhooks
关键字:
README 文档
README
Automatically send beautiful Discord notifications when your Laravel queue jobs fail. Zero configuration needed beyond the webhook URL!
Installation
Install via Composer:
composer require the-trybe/laravel-discord-alerts
Configuration
1. Create a Discord Webhook
- Open your Discord server
- Go to Server Settings → Integrations → Webhooks
- Click New Webhook
- Name it (e.g., "Laravel Alerts" or whatever~)
- Select the channel where alerts should be posted
- Copy the Webhook URL
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!
That's it! The package will automatically send Discord alerts when any queue job fails.
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
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
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?
Each Discord alert includes:
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):
- Job Payload - Job properties and data
- Stack Trace - Full exception stack trace
Environment-Based Colors
Alerts are color-coded based on environment:
- Production - Red (critical)
- Staging - Orange (warning)
- Local/Other - Yellow (info)
Troubleshooting
Not Receiving Alerts?
-
Check webhook URL is set:
php artisan config:clear php artisan tinker >>> config('discord-alerts.webhook_url') -
Check alerts are enabled:
>>> config('discord-alerts.enabled') -
Check Laravel logs for any errors:
tail -f storage/logs/laravel.log
-
Test the webhook directly:
curl -X POST "YOUR_WEBHOOK_URL" \ -H "Content-Type: application/json" \ -d '{"content": "Test message from Laravel"}'
License
The MIT License (MIT). Please see License File for more information.
Credits
the-trybe/laravel-discord-alerts 适用场景与选型建议
the-trybe/laravel-discord-alerts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「notifications」 「alerts」 「monitoring」 「laravel」 「webhooks」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 the-trybe/laravel-discord-alerts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 the-trybe/laravel-discord-alerts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 the-trybe/laravel-discord-alerts 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova package that adds a notification feed in your Nova app.
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Add visual alerts / warnings to Flarum posts
Laravel package for managing session messages and alerts in view responses
Bootstrap alerts
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-15