dev-master
9999999-dev https://github.com/AuroraAri/Discord-Webhooks-PHPA custom library from auroraari's discord webhooks for php.
Unlicense
The Requires
- php >=5.3
by Arianna Story
php discord wrapper webhooks discordapp
A custom library from auroraari's discord webhooks for php.
A lightweight wrapper to interact with Discord webhooks!, (*1)
This wrapper is installed by using Composer. You also need to have (at least) PHP 5.3 installed, along with ext-curl. This wrapper has not been tested with HHVM, but there's no reason it shouldn't work!, (*2)
composer require auroraari/discord-webhooks
to install the latest release.include __DIR__.'/vendor/autoload.php';
This currently only works in Discord's public test build, which can be found here for Windows and here for Mac., (*3)
On a server you own (or have the "Manage Webhooks" permission on), open Server Settings, and select 'Webhooks' on the menu: , (*4)
Click the "Create Webhook" button and complete the form. The "Name" field and avatar that you set are the defaults, and may be overriden in this wrapper, but the channel you pick cannot be changed by the wrapper. You'll need a separate URL for each channel you want to post to. , (*5)
Copy the "Webhook URL," and use that when initializing the class., (*6)
Enjoy!, (*7)
<?php include __DIR__.'/vendor/autoload.php';` use \DiscordWebhooks\Client as DiscordWebhook; $discord = new DiscordWebhook('URL-FROM-DISCORD'); $discord->name('AuroraAri'); // Optionally, provide a name that the message will be sent from. If not set, uses the name set in Discord. $discord->avatar('http://i.imgur.com/RNYMCQp.png'); // Optionally, a URL for the user's avatar. If not set, uses the avatar set in Discord. $discord->message('Hi, Discord!'); // Optionally, set the message to be sent here. If not set, uses the message in $this->send(). $discord->send('Hi again, Discord!'); // If the message wasn't set in $this->message, it must be set here. This method sends the message.
A custom library from auroraari's discord webhooks for php.
Unlicense
php discord wrapper webhooks discordapp