Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Discord Alerts

Laravel Discord Alerts Laravel Package

spatie/laravel-discord-alerts

Send Discord alerts from Laravel via a simple facade. Configure a Discord webhook URL and queue messages via a job so your app won’t fail if Discord is down. Ideal for notifying you about noteworthy events (errors, signups, deploys).

View on GitHub
Deep Wiki
Context7

Quickly send a message to Discord

Frequently asked questions about Laravel Discord Alerts
How do I send a Discord alert from a Laravel event listener?
Use the `DiscordAlert` facade inside your event listener. For example, in your `UserRegistered` listener, call `DiscordAlert::message('New user registered: ' . $user->name)`. The package automatically queues the job for async processing.
Does this package support rich embeds or custom Discord message formatting?
Yes, you can customize embeds via the `config/discord-alerts.php` file or by extending the `DiscordAlert` facade. Use methods like `embed()` to add fields, thumbnails, or timestamps. Check the [README](https://github.com/spatie/laravel-discord-alerts) for examples.
What Laravel versions are officially supported?
The package is tested for Laravel 9+ and requires PHP 8.1+. While it may work on older versions (e.g., Laravel 8 with PHP 8.0), Spatie does not guarantee compatibility. Always test in a staging environment before upgrading.
How do I handle failed Discord alerts (e.g., API rate limits or downtime)?
Failed jobs are retried by Laravel’s queue system (configurable via `QUEUE_CONNECTION`). Monitor failed jobs in the `failed_jobs` table or use Laravel Horizon for visibility. For critical alerts, consider adding fallback notifications (e.g., email) via event listeners.
Can I use this package with a Discord bot token instead of a webhook?
Yes, configure either `DISCORD_WEBHOOK_URL` or `DISCORD_BOT_TOKEN` in your `.env`. The package supports both methods, but webhooks are simpler for one-off alerts. Bots require additional setup (e.g., OAuth2 permissions) for interactive features.
Will this package work with Laravel Horizon for queue monitoring?
Absolutely. Since the package uses Laravel’s queue system, Horizon will track job progress, failures, and throughput. Ensure your `QUEUE_CONNECTION` in `.env` points to `redis` or another Horizon-supported driver.
How do I secure Discord credentials across dev/staging/prod environments?
Store `DISCORD_WEBHOOK_URL` or `DISCORD_BOT_TOKEN` in environment variables (`.env`). For production, use a secrets manager (e.g., AWS Secrets Manager, Vault) and load them dynamically via Laravel’s `env()` helper or a custom config loader.
Is there a way to log sent Discord alerts for audit purposes?
The package doesn’t include built-in logging, but you can log alerts manually by wrapping `DiscordAlert::message()` in a `try-catch` block or using Laravel’s logging facade. For example, `Log::info('Discord alert sent', ['message' => $message])`.
What happens if Discord’s API changes or goes down during high alert volume?
The package uses Laravel’s queue system to retry failed jobs. For high-volume alerts, ensure your queue worker (`queue:work`) can handle backpressure (e.g., scale horizontally with Redis). Monitor Discord’s [status page](https://discordstatus.com/) for outages.
Are there alternatives to this package for sending Laravel alerts to Discord?
Yes, alternatives include custom solutions using the [Discord API](https://discord.com/developers/docs/resources/webhook) directly or third-party packages like `laravel-discord-notifications`. However, Spatie’s package offers deeper Laravel integration (events, queues) and active maintenance.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport