noynac/phpcord-webhooks

A PHP wrapper for using Discord's webhook API

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/noynac/phpcord-webhooks

v1.0.0 2021-05-17 00:42 UTC

This package is not auto-updated.

Last update: 2025-09-30 19:34:31 UTC


README

Software License

This is a small WIP library for using discord webhooks.

Install

composer require noynac/phpcord-webhooks

Usage

require_once "vendor/autoload.php";

use DiscordWebhook\Message;
use DiscordWebhook\Embed;

$webhook = 'YOUR-WEBHOOK-URL-HERE';

$message = new Message();
$message->setWebhook($webhook)
    ->setMessage("some message")
    ->setUsername("username here");

$newEmbed = new Embed();
$newEmbed->setColor('1000')
	->setTitle('Some title')
	->setURL('https://github.com/Sooshiii/phpcord-webhooks')
	->setAuthor('Some name', 'https://i.imgur.com/EJOjIMC.jpg')
	->setDescription('Some description here')
	->setThumbnail('https://i.imgur.com/EJOjIMC.jpg')
	->addField('Inline field title', 'Some value here', true)
	->setImage('https://i.imgur.com/EJOjIMC.jpg')
	->setTimestamp()
	->setFooter('Some footer text here', 'https://i.imgur.com/EJOjIMC.jpg');
      
$message->addEmbed($newEmbed);

$message->send();

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.