PHP code example of discord-php-extended / discordphp-mtg

1. Go to this page and download the library: Download discord-php-extended/discordphp-mtg 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/ */

    

discord-php-extended / discordphp-mtg example snippets


$mtg = new \MTG\MTG(['token' => getenv('TOKEN')]);

$mtg->cards->getCards(['name' => 'Black Lotus'])->then(fn ($cards) => $cards->first());
$mtg->cards->fetch('cardId')->then(fn ($card) => $card);
$mtg->sets->getSets(['name' => 'Khans of Tarkir'])->then(fn ($sets) => $sets->first());
$mtg->sets->generateBooster('KTK')->then(fn ($pack) => $pack);   // needs a self-hosted mtg-api

$mtg->getTypes();       // ['Artifact', 'Creature', 'Instant', …]
$mtg->getSubtypes();    // ['Elf', 'Equipment', …]
$mtg->getSupertypes();  // ['Basic', 'Legendary', 'Snow', …]
$mtg->getFormats();     // ['Standard', 'Modern', 'Commander', …]
cmd
   git clone https://github.com/discord-php/DiscordPHP-MTG.git
   cd DiscordPHP-MTG
   
cmd
   php bot.php