2017 © Pedro Peláez
 

library discord-webhooks

Simple wrapper for building and sending webhooks with Discord's webhook API

image

forien/discord-webhooks

Simple wrapper for building and sending webhooks with Discord's webhook API

  • Tuesday, April 10, 2018
  • by Forien
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 25 % Grown

The README.md

discord-webhooks

Simple wrapper for building and sending webhooks with Discord's webhook API, (*1)

Allows for both simple small uses (single Webhook object to single Hook (url)) and mass dispatchers for multiple channels or with multiple Webhook object., (*2)

Built with simple end-user OOP approach in mind (method chaining for example)., (*3)

@todo README & documentation, (*4)

// dispatcher manages building and sending webhooks
$dispatch = \Forien\WebhookDispatcher::getInstance();

// to create new Webhook object you can use either:
$webhook = $dispatch->createWebhook();
// or:
$webhook = new \Forien\DiscordHelpers\Webhook();


$webhook->setContent('some basic text');
$embed = $webhook->addEmbed();
$embed->addAuthor(['name' => 'Forien', 'icon_url' => '/*...*/']);
$embed->addField()->setName('name')->setValue('value');
$embed->addField()->setName('name2')->setValue('value2');
$embed->setColor('#cba');

// you can either add Hooks (Discord webhook urls) through either:
$dispatch->addHook('https://...');
$dispatch->setHooks(['https://...', ...])

// you can send attach Webhook object to Dispatcher if you created it independly:
$dispatch->addWebhook($webhook);

// you can send all attached Webhook objects at once (every will be sent to every Hook):
$dispatch->send()

// you can also specify single webhook-hook:
$dispatch->send($webhook, $hook);

The Versions

10/04 2018

dev-master

9999999-dev

Simple wrapper for building and sending webhooks with Discord's webhook API

  Sources   Download

BSD-3-Clause

The Requires

  • php ~7.0

 

curl discord webhook

10/04 2018

0.1.0-beta

0.1.0.0-beta

Simple wrapper for building and sending webhooks with Discord's webhook API

  Sources   Download

BSD-3-Clause

The Requires

  • php ~7.0

 

curl discord webhook