PHP code example of livaco / easydiscordwebhook

1. Go to this page and download the library: Download livaco/easydiscordwebhook 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/ */

    

livaco / easydiscordwebhook example snippets


$webhook = DiscordWebhook::new("https://discord.com/api/webhooks/your/webhook");

DiscordWebhook::new("https://discord.com/api/webhooks/your/webhook")
    ->setContent("Hello, world!")
    ->execute();

DiscordWebhook::new("https://discord.com/api/webhooks/your/webhook")
    ->addEmbed(Embed::new()
        ->setTitle("Cyberpunk 2077")
        ->setDescription("Cyberpunk 2077 is an open-world, action-adventure RPG set in the megalopolis of Night City, where you play as a cyberpunk mercenary wrapped up in a do-or-die fight for survival. Improved and featuring all-new free additional content, customize your character and playstyle as you take on jobs, build a reputation, and unlock upgrades. The relationships you forge and the choices you make will shape the story and the world around you. Legends are made here. What will yours be?")
        ->addField("Release Date", "December 10, 2020", true)
        ->addField("Platforms", "All Major Platforms", true)
        ->addField("Developer", "CD Projekt Red", true)
        ->setColor("#FCFF2B")
        ->setUrl("https://www.cyberpunk.net/gb/en/")
        ->setImage("https://upload.livaco.dev/u/nYLGepk6X2.png")
    )
    ->execute();