PHP code example of m0by_cze / dmdiscordmsg

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

    

m0by_cze / dmdiscordmsg example snippets




use AG\DiscordMsg;

s!'))->send();




echo "To see dumb messages..\n";
echo "..join the discordmsg chanel https://discord.gg/Bh4EZB and enjoy!\n";
echo "Feel free to test!\n";


// First message
$msg = new \AG\DiscordMsg('Hello, Friends');
$msg->send();


// Second message
(new \AG\DiscordMsg(
    'I started the example.php, something happened?',
    null,
    $_ENV["USER"] ?? 'Mr. Pitkin'
))->send();


// Third message
(new \AG\DiscordMsg(
    "Maybe the missile is launched? :grimacing:", // message
    'https://discordapp.com/api/webhooks/475239272610398218/' . // chanel webhook link
        'tfpeg5EFI_94oEHfltZwcB5UAurfcswkBw5mKouZCq-akhvxe5BNOtN16AqSHvmSwpum',
    get_current_user(), // bot name
    '' // avatar url
))->send();



$msg = "<@4386638385456546554> is notified";
(new \AG\DiscordMsg(
  $msg, // message
  $webhookurl, // chanel webhook link
  "Trad Bot", // bot name
  '' // avatar url
))->send();
bash
$ php example.php