labymod/discord-webhook

A lightweight library for Discord™ Webhooks

3.1.3 2022-01-25 23:34 UTC

This package is auto-updated.

Last update: 2024-11-04 16:27:40 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads Scrutinizer Code Quality License

Send Discord messages directly from your PHP application. Even with embeds & files!

Versions & Compatibility

Installation

Composer installation

composer require labymod/discord-webhook

Documentation

Hop into the wonderful world of webhooks with just those few lines:

use DiscordWebhook\Webhook;

$wh = new Webhook('https://my.webhook/url');
$wh
    ->setMessage('Hello world!')
    ->send();

✨ NEW: Simple Webhooks

First (recommended but optional): Define the DWH_DEFAULT_URL as environment variable

use DiscordWebhook\SimpleWebhook;

// with environment variable defined:
SimpleWebhook::sendMessage('My simple message.');

// without environment variable defined (or to override the already set env var):
SimpleWebhook::sendMessage('My simple message.', 'https://discord.com/my/webhook/url');

For further documentation have a look here: