1. Go to this page and download the library: Download magiclegacy/mtgmelee-client 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/ */
magiclegacy / mtgmelee-client example snippets
namespace Application;
use MagicLegacy\Component\MtgMelee\Client\TournamentClient;
use Eureka\Component\Curl;
use Nyholm\Psr7\Factory\Psr17Factory;
tpClient(),
$httpFactory,
$httpFactory,
$httpFactory
);
$tournament = $mtgMeleeClient->getTournament(14139);
echo "{$tournament->getName()} (#{$tournament->getId()}, date: {$tournament->getDate()->format('Y-m-d H:i:s')}, link {$tournament->getLink()})\n------------------------------\n\n";
foreach ($tournament->getRounds() as $round) {
echo "{$round->getName()} (#{$round->getId()}, is top: {$round->isTop()})\n";
}
// ...
$rounds = $mtgMeleeClient->getRounds(14139);
foreach ($rounds as $round) {
echo "{$round->getName()} (#{$round->getId()}, is top: {$round->isTop()})\n";
}