1. Go to this page and download the library: Download ryantxr/discord-webhook 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/ */
ryantxr / discord-webhook example snippets
use Ryantxr\Discord\Webhook\Client as Webhook;
$webhook = new Webhook( 'YOUR_DISCORD_WEBHOOK_URL' );
$webhook->message('This is a message');
use Ryantxr\Discord\Webhook\Client as Webhook;
use Ryantxr\Discord\Webhook\Embed;
// Get this from some config
$webhookConfig = [
'url' => 'YOUR_DISCORD_WEBHOOK_URL',
'username' => 'funnybot',
'avatar' => 'https://pbs.twimg.com/media/C51iiP9UYAIPpWP.png',
];
$webhook = new Webhook( $webhookConfig );
$embed = new Embed('SOME_URL_YOU_WANT');
$embed->title('This is a title')
->author('Justin', 'https://authors-website.com', 'https://discordapp.com/assets/28174a34e77bb5e5310ced9f95cb480b.png')
->field('Field 1', 'Some cool text', true )
->field('Field 2', 'Another cool text', true )
->color(15158332)
;
$webhook->send($embed, "A message goes here.");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.