PHPackages                             tomatophp/discord-notifications - 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. tomatophp/discord-notifications

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

tomatophp/discord-notifications
===============================

Laravel notification driver for Discord.

v1.0.0(2y ago)03.5k2MITPHPPHP ^7.2|^8.0|^8.1

Since Mar 12Pushed 2y agoCompare

[ Source](https://github.com/tomatophp/discord-notifications)[ Packagist](https://packagist.org/packages/tomatophp/discord-notifications)[ Docs](https://github.com/laravel-notification-channels/discord)[ RSS](/packages/tomatophp-discord-notifications/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (2)

Discord notification channel for Laravel 6.0+
=============================================

[](#discord-notification-channel-for-laravel-60)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d6f73186aedceefb05a32ad030d3decc8ee783a830963022c064e87c57507504/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f646973636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/discord)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d9e506cf7581900c5bc16f1800a510737e285b81f54bc88fb268b8be71d37296/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f646973636f72642f5048502e7376673f7374796c653d666c61742d737175617265)](https://github.com/laravel-notification-channels/discord/actions)[![StyleCI](https://camo.githubusercontent.com/93fd577392d2966d95a8bc9922da4a06d8c381e5b83efaa02d4089bda35dfff0/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353737323439322f736869656c64)](https://styleci.io/repos/65772492)[![Quality Score](https://camo.githubusercontent.com/6a1209cfc5870e5bf723e60b8eec1b3469efcbcf945a051fae07f4ab991e5df0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f646973636f72642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/discord)[![Code Coverage](https://camo.githubusercontent.com/f5641469f94960c6475f5a730fc98576374dab7633e6e1573ef8a716078eb1e7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f646973636f72642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/discord/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/2c966d30257e2a768b755c544e9047bfe1f11458c525160501009e8bf48a6eef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f646973636f72642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/discord)

This package makes it easy to send notifications using the [Discord bot API](https://discord.com/developers/docs/intro) with Laravel.

Contents
--------

[](#contents)

- [Discord notification channel for Laravel 6.0+](#discord-notification-channel-for-laravel-56)
    - [Contents](#contents)
    - [Installation](#installation)
        - [Setting up your Discord bot](#setting-up-your-discord-bot)
    - [Usage](#usage)
        - [Available Message methods](#available-message-methods)
    - [Changelog](#changelog)
    - [Testing](#testing)
    - [Security](#security)
    - [Contributing](#contributing)
    - [Credits](#credits)
    - [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require laravel-notification-channels/discord
```

Next, you must load the service provider:

```
// config/app.php
'providers' => [
    // ...
    NotificationChannels\Discord\DiscordServiceProvider::class,
],
```

### Setting up your Discord bot

[](#setting-up-your-discord-bot)

1. [Create a Discord application.](https://discord.com/developers/applications)
2. Click the `Create a Bot User` button on your Discord application.
3. Paste your bot's API token, found under `App Bot User`, in your `services.php` config file:

    ```
    // config/services.php
    'discord' => [
        'token' => 'YOUR_API_TOKEN',
    ],
    ```
4. Add the bot to your server and identify it by running the artisan command:

    ```
    php artisan discord:setup
    ```

Usage
-----

[](#usage)

In every model you wish to be notifiable via Discord, you must add a channel ID property to that model accessible through a `routeNotificationForDiscord` method:

```
class Guild extends Eloquent
{
    use Notifiable;

    public function routeNotificationForDiscord()
    {
        return $this->discord_channel;
    }
}
```

> **NOTE**: Discord handles direct messages as though they are a regular channel. If you wish to allow users to receive direct messages from your bot, you will need to create a private channel with that user.
>
> An example workflow may look like the following:
>
> 1. Your `users` table has two discord columns: `discord_user_id` and `discord_private_channel_id`
> 2. When a user updates their Discord user ID (`discord_user_id`), generate and save a private channel ID (`discord_private_channel_id`)
> 3. Return the user's `discord_private_channel_id` in the `routeNotificationForDiscord` method on the `User` model
>
> You can generate direct message channels by using the `getPrivateChannel` method in the `NotificationChannels\Discord\Discord` class
>
> ```
> use NotificationChannels\Discord\Discord;
>
> class UserDiscordSettingsController
> {
>     public function store(Request $request)
>     {
>         $userId = $request->input('discord_user_id');
>         $channelId = app(Discord::class)->getPrivateChannel($userId);
>
>         Auth::user()->update([
>             'discord_user_id' => $userId,
>             'discord_private_channel_id' => $channelId,
>         ]);
>     }
> }
> ```
>
>
>
> Please take note that the `getPrivateChannel` method only accepts [Discord's snowflake IDs](https://discord.com/developers/docs/reference#snowflakes). There is no API route provided by Discord to lookup a user's ID by their name and tag, and the process for copying and pasting a user ID can be confusing to some users. Because of this, it is recommended to add the option for users to connect their Discord account to their account within your application either by logging in with Discord or linking it to their pre-existing account.

You may now tell Laravel to send notifications to Discord channels in the `via` method:

```
// ...
use NotificationChannels\Discord\DiscordChannel;
use NotificationChannels\Discord\DiscordMessage;

class GameChallengeNotification extends Notification
{
    public $challenger;

    public $game;

    public function __construct(Guild $challenger, Game $game)
    {
        $this->challenger = $challenger;
        $this->game = $game;
    }

    public function via($notifiable)
    {
        return [DiscordChannel::class];
    }

    public function toDiscord($notifiable)
    {
        return DiscordMessage::create("You have been challenged to a game of *{$this->game->name}* by **{$this->challenger->name}**!");
    }
}
```

### Available Message methods

[](#available-message-methods)

- `body(string)`: Set the content of the message. ([Supports basic markdown](https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-))
- `embed(array)`: Set the embedded content. ([View embed structure](https://discord.com/developers/docs/resources/channel#embed-object))
- `components(array)`: Set the component content. ([View component structure](https://discord.com/developers/docs/interactions/message-components#component-object))

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Cody Scott](https://github.com/codyphobe)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

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

836d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2147eb2fca7ab5f0124d0fafd88ba2d2a5dfa3a0036fb8872d1084b7cba29366?d=identicon)[fadymondy](/maintainers/fadymondy)

---

Top Contributors

[![codyphobe](https://avatars.githubusercontent.com/u/207072?v=4)](https://github.com/codyphobe "codyphobe (54 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (10 commits)")[![BennySama](https://avatars.githubusercontent.com/u/24943944?v=4)](https://github.com/BennySama "BennySama (8 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (4 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (3 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (2 commits)")[![kawax](https://avatars.githubusercontent.com/u/1502086?v=4)](https://github.com/kawax "kawax (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![messerli90](https://avatars.githubusercontent.com/u/3306651?v=4)](https://github.com/messerli90 "messerli90 (2 commits)")[![nullx27](https://avatars.githubusercontent.com/u/73673?v=4)](https://github.com/nullx27 "nullx27 (2 commits)")[![jee7](https://avatars.githubusercontent.com/u/3455815?v=4)](https://github.com/jee7 "jee7 (1 commits)")[![corsair](https://avatars.githubusercontent.com/u/1847891?v=4)](https://github.com/corsair "corsair (1 commits)")[![ricardoboss](https://avatars.githubusercontent.com/u/6266356?v=4)](https://github.com/ricardoboss "ricardoboss (1 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (1 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (1 commits)")[![maartenvw](https://avatars.githubusercontent.com/u/9413341?v=4)](https://github.com/maartenvw "maartenvw (1 commits)")[![romulosalmeida](https://avatars.githubusercontent.com/u/37348255?v=4)](https://github.com/romulosalmeida "romulosalmeida (1 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (1 commits)")[![xHeinrich](https://avatars.githubusercontent.com/u/7674587?v=4)](https://github.com/xHeinrich "xHeinrich (1 commits)")[![fadymondy](https://avatars.githubusercontent.com/u/11937812?v=4)](https://github.com/fadymondy "fadymondy (1 commits)")

---

Tags

laravelnotificationdriverdiscordchannel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tomatophp-discord-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/tomatophp-discord-notifications/health.svg)](https://phpackages.com/packages/tomatophp-discord-notifications)
```

###  Alternatives

[laravel-notification-channels/discord

Laravel notification driver for Discord.

2381.4M13](/packages/laravel-notification-channels-discord)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.7M42](/packages/laravel-notification-channels-telegram)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

252143.0k](/packages/erag-laravel-disposable-email)[snoeren-development/laravel-discord-webhook-channel

Send notifications to a Discord webhook.

1553.0k1](/packages/snoeren-development-laravel-discord-webhook-channel)

PHPackages © 2026

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