1. Go to this page and download the library: Download ccoeder/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/ */
ccoeder / discord-webhook example snippets
use Illuminate\Notifications\Notification;
use NotificationChannels\DiscordWebhook\DiscordWebhookMessage;
class Application extends Notification
{
public function via($notifiable)
{
return ['discord-webhook'];
}
public function toDiscordWebhook($notifiable)
{
return (new DiscordWebhookMessage())
->content('Your guild received a new membership application!');
}
}
public function routeNotificationForDiscordWebhook()
{
return 'https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token}';
}
public function toDiscordWebhook($notifiable)
{
return (new DiscordWebhookMessage())
->from('Raid Calendar')
->content('**Next Raids**')
->embed(function ($embed) {
$embed->title('Dragon Dungeon')->description('*on Monday*')
->field('Raid Leader', 'TheTank', true)
->field('Co-Leader', 'HealMePls', true);
});
}
public function toDiscordWebhook($notifiable)
{
return (new DiscordWebhookMessage())
->content('__Member of the Day:__')
->file(\Storage::get('motd_avatar.png'), 'member_of_the_day.png');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.