PHP code example of mountrix / laravel-discord-notifier

1. Go to this page and download the library: Download mountrix/laravel-discord-notifier 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/ */

    

mountrix / laravel-discord-notifier example snippets


use Mountrix\DiscordNotification\DiscordNotifier;

$discord = new DiscordNotifier('your-webhook-url');
$discord->sendNotification(
    "Hi, It is an autogenerated message.", 
    false // true: errorAlert, false: successAlert
);

return response()->json(["message" => "Notified"]);

use Mountrix\DiscordNotification\DiscordNotifier;

$discord = new DiscordNotifier('your-webhook-url');
$discord->sendNotification(
    "Order delivered", 
    false, 
    'User info', 
    [
        "order_id" => 'ABC1234', 
        'amount' => 200
    ]
);

return response()->json(["message" => "Notified"]);