1. Go to this page and download the library: Download hesmatt/discord-hooker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hesmatt / discord-hooker example snippets
use HesMatt\DiscordHooker\Client\Webhook;
$webhook = new Webhook('Your webhook _URL_');
$webhook->setMessage('I am a Discord Hooker');
$webhook->send();
use HesMatt\DiscordHooker\Client\Webhook;
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$webhook = new Webhook('Your webhook _URL_');
$webhook->setMessage('I am a Discord Hooker');
$webhook->setUsername('Hooker');
$webhook->setAvatar('The url of your image'); //Note that this always has to be an URL, not a file!
$webhook->send();
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->setTitle('I am a test embed');
//The description is optional and you don't have to set it, but I wanted to mention is as well :)
$embed->setDescription('I am test embed description');
use HesMatt\DiscordHooker\Client\Webhook;
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$webhook = new Webhook('Your webhook _URL_');
$embed = new Embed(); //Let's assume we have the different parts we've already built.
//You can use all of the settings for $webhook from earlier, to make the code shorter I won't be typing them again from now on.
$webhook->addEmbed($embed);
$webhook->send();
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->setFooter('The footer text', 'The footer image URL');
//Setting the time part of footer, we can either use
$embed->setTimestamp(new DateTimeImmutable());
//or (To use current time)
$embed->setTimestampNow();
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->setColor('327424'); //Discord is using an int value of the color.
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->setThumbnail('Url of the thumbnail image');
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->setAuthor('Name of Author','Icon of author','Url of author');
use HesMatt\DiscordHooker\Dto\Embed\Embed;
$embed = new Embed();
$embed->addField('Text','Value',false); //The last parameter is whether you want the field to be inlined or no.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.