PHPackages                             nwilging/laravel-discord-bot - 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. nwilging/laravel-discord-bot

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

nwilging/laravel-discord-bot
============================

A robust Discord messaging integration for Laravel

1.1.1(3y ago)576.0k↑33.3%8[10 issues](https://github.com/nwilging/laravel-discord-bot/issues)MITPHPPHP &gt;=7.4

Since Apr 28Pushed 2y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (4)Versions (11)Used By (0)

Laravel Discord Bot
===================

[](#laravel-discord-bot)

A robust Discord messaging integration for Laravel

[![Tests](https://github.com/nwilging/laravel-discord-bot/actions/workflows/main-branch.yml/badge.svg?branch=main)](https://github.com/nwilging/laravel-discord-bot/actions/workflows/main-branch.yml/badge.svg?branch=main)[![Coverage](./.github/coverage-badge.svg)](./.github/coverage-badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/da59c748d0ee92e0671d80db3308c68ec924dcccc41d546b96d692c050650334/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d646973636f72642d626f742f76)](https://packagist.org/packages/nwilging/laravel-discord-bot)[![License](https://camo.githubusercontent.com/1bee4cf718cc5e3382160e8ed833ec9cbb151c28a57acb8a8d4c5668589043c2/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d646973636f72642d626f742f6c6963656e7365)](https://packagist.org/packages/nwilging/laravel-discord-bot)[![Total Downloads](https://camo.githubusercontent.com/7806ac626d7bb18029b9d5b3f9cb55a11467ee04df5cbe5c509836e6fa40b575/687474703a2f2f706f7365722e707567782e6f72672f6e77696c67696e672f6c61726176656c2d646973636f72642d626f742f646f776e6c6f616473)](https://packagist.org/packages/nwilging/laravel-discord-bot)

---

### About

[](#about)

This package provides a notification channel to send messages to Discord, as well as a suite of tools, services, and components that will help you to build rich-text messages as well as handle [Discord Interactions](https://discord.com/developers/docs/interactions/receiving-and-responding).

---

Installation
============

[](#installation)

### Pre Requisites

[](#pre-requisites)

1. Laravel v8+
2. PHP 7.4+
3. [libsodium](https://doc.libsodium.org/bindings_for_other_languages#programming-languages-whose-standard-library-includes-support-for-libsodium)

### Install with Composer

[](#install-with-composer)

```
composer require nwilging/laravel-discord-bot

```

### Configuration

[](#configuration)

1. Visit the [Discord Developer Portal](https://discord.com/developers/applications) and create a new Application
2. Copy the Application ID and the Public Key
3. Create a Bot User
4. Reset the Bot User Token and copy it

Populate your `.env`:

```
DISCORD_API_BOT_TOKEN=
DISCORD_APPLICATION_ID=
DISCORD_PUBLIC_KEY=

```

#### Additional Configuration (optional)

[](#additional-configuration-optional)

When handling interactions the default response behavior is to "defer" - aka stop the loading process in the Discord app window and return no reply or other message. If you'd like to change this to "load" - which will show a loading message until your application sends a followup message - add the following to your `.env`:

```
DISCORD_COMPONENT_INTERACTION_DEFAULT_BEHAVIOR=load

```

Notification Channel Usage
==========================

[](#notification-channel-usage)

Your notification class must implement the interface `Nwilging\LaravelDiscordBot\Contracts\Notifications\DiscordNotificationContract`, and include the `toDiscord(): array`method.

#### Example with Plain Text message

[](#example-with-plain-text-message)

```
