PHPackages                             spatie/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. spatie/laravel-discord-alerts

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

spatie/laravel-discord-alerts
=============================

Send a message to Discord

1.9.1(2mo ago)151408.0k—0.3%27[1 PRs](https://github.com/spatie/laravel-discord-alerts/pulls)MITPHPPHP ^8.3CI passing

Since Jan 21Pushed 2mo ago3 watchersCompare

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

READMEChangelog (10)Dependencies (16)Versions (21)Used By (0)

Quickly send a message to Discord
=================================

[](#quickly-send-a-message-to-discord)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ad398a0547fe3a3cba1eb32a347ca4a869dadcb04535d8f97e9949a632b11857/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d646973636f72642d616c657274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-discord-alerts)[![run-tests](https://github.com/spatie/laravel-discord-alerts/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/laravel-discord-alerts/actions/workflows/run-tests.yml)[![PHPStan](https://github.com/spatie/laravel-discord-alerts/actions/workflows/phpstan.yml/badge.svg)](https://github.com/spatie/laravel-discord-alerts/actions/workflows/phpstan.yml)[![Check & fix styling](https://github.com/spatie/laravel-discord-alerts/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/spatie/laravel-discord-alerts/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/ced380ac4bda3b7e75cdbfbf6533d82d8928e3caee42761c798d7776e2b76d2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d646973636f72642d616c657274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-discord-alerts)

This package can quickly send alerts to Discord. You can use this to notify yourself of any noteworthy events happening in your app.

Want to quickly send alerts to Slack? Then check out [laravel-slack-alerts](https://github.com/spatie/laravel-slack-alerts).

```
use Spatie\DiscordAlerts\Facades\DiscordAlert;

DiscordAlert::message("You have a new subscriber to the {$newsletter->name} newsletter!");
```

Under the hood, a job is used to communicate with Discord. This prevents your app from failing in case Discord is down.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/d33cc0749f7465532d690eca930bba98defba59b8bd0510dab55fdae0f81ff17/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d646973636f72642d616c657274732e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-discord-alerts)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard ``wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-discord-alerts
```

You can set a `DISCORD_ALERT_WEBHOOK` env variable containing a valid Discord webhook URL. You can learn how to get a webhook URL [in the Discord API docs](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).

Alternatively, you can publish the config file with:

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

This is the contents of the published config file:

```
