PHPackages                             pkvas/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pkvas/laravel-discord-alerts

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pkvas/laravel-discord-alerts
============================

Send a message to Discord

10PHP

Since Nov 24Pushed 2y agoCompare

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

READMEChangelogDependenciesVersions (1)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:

```
return [
    /*
     * The webhook URLs that we'll use to send a message to Discord.
     */
    'webhook_urls' => [
        'default' => env('DISCORD_ALERT_WEBHOOK'),
    ],

    /*
     * This job will send the message to Discord. You can extend this
     * job to set timeouts, retries, etc...
     */
    'job' => Spatie\DiscordAlerts\Jobs\SendToDiscordChannelJob::class,
];
```

Usage
-----

[](#usage)

To send a message to Discord, simply call `DiscordAlert::message()` and pass it any message you want.

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

Sending an embed
----------------

[](#sending-an-embed)

To send an embed you can call the same function as above. Just add the embed as a second array as following:

```
DiscordAlert::message("You have a new subscriber to the {$newsletter->name} newsletter!", [
    [
        'title' => 'My title',
        'description' => 'My description',
        'color' => '#E77625',
        'author' => [
            'name' => 'Spatie',
            'url' => 'https://spatie.be/'
        ]
    ]
]);
```

You can also send multiple embeds as one message. Just be careful that you don't hit the limit of Discord.

Using multiple webhooks
-----------------------

[](#using-multiple-webhooks)

You can also use an alternative webhook, by specify extra ones in the config file.

```
// in config/discord-alerts.php

'webhook_urls' => [
    'default' => 'https://hooks.discord.com/services/XXXXXX',
    'marketing' => 'https://hooks.discord.com/services/YYYYYY',
],
```

The webhook to be used can be chosen using the `to` function.

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

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

### Using a custom webhooks

[](#using-a-custom-webhooks)

The `to` function also supports custom webhook urls.

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

DiscordAlert::to('https://custom-url.com')->message("You have a new subscriber to the {$newsletter->name} newsletter!");
```

Formatting
----------

[](#formatting)

### Markdown

[](#markdown)

You can format your messages with markup. Learn how [in the Discord API docs](https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-).

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

DiscordAlert::message("A message **with some bold statements** and _some italicized text_.");
```

### Emoji's

[](#emojis)

You can use the same emoji codes as in Discord. This means custom emoji's are also supported.

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

DiscordAlert::message(":smile: :custom-code:");
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rias Van der Veken](https://github.com/Riasvdv)
- [Niels Vanpachtenbeke](https://github.com/Nielsvanpach)
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

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://www.gravatar.com/avatar/75532a159c0dc575586863f35b40b5e595b7529606179060db1a0921edf84651?d=identicon)[pkvas](/maintainers/pkvas)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (20 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (8 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (7 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (4 commits)")[![nssnl](https://avatars.githubusercontent.com/u/255468?v=4)](https://github.com/nssnl "nssnl (4 commits)")[![pkvas](https://avatars.githubusercontent.com/u/14582103?v=4)](https://github.com/pkvas "pkvas (2 commits)")[![zepfietje](https://avatars.githubusercontent.com/u/44533235?v=4)](https://github.com/zepfietje "zepfietje (1 commits)")[![clydesantiago](https://avatars.githubusercontent.com/u/31274021?v=4)](https://github.com/clydesantiago "clydesantiago (1 commits)")[![FinnPaes](https://avatars.githubusercontent.com/u/71390226?v=4)](https://github.com/FinnPaes "FinnPaes (1 commits)")[![Jamesclark32](https://avatars.githubusercontent.com/u/13315960?v=4)](https://github.com/Jamesclark32 "Jamesclark32 (1 commits)")[![localhousee](https://avatars.githubusercontent.com/u/32237745?v=4)](https://github.com/localhousee "localhousee (1 commits)")[![rico-vz](https://avatars.githubusercontent.com/u/107053109?v=4)](https://github.com/rico-vz "rico-vz (1 commits)")

### Embed Badge

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

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

###  Alternatives

[fntneves/laravel-transactional-events

Transaction-aware Event Dispatcher for Laravel

3202.6M2](/packages/fntneves-laravel-transactional-events)[ipinfo/ipinfo

The official PHP library for IPinfo, the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier and IP type data sets. Visit our developer docs at https://ipinfo.io/developers.

2891.2M11](/packages/ipinfo-ipinfo)[craftcms/plugin-installer

Craft CMS Plugin Installer

283.3M4](/packages/craftcms-plugin-installer)[typo3/cms-recordlist

TYPO3 CMS Recordlist - Lists database records in the TYPO3 backend module (Web&gt;List).

178.0M48](/packages/typo3-cms-recordlist)[broadway/uuid-generator

UUID generator for broadway/broadway.

202.1M11](/packages/broadway-uuid-generator)

PHPackages © 2026

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