Installation
Install the SDK using Composer
composer require tcgdex/sdk
if you don’t have the PSRs 16,17 & 18 implementations, you can quickly add them using this command
composer require symfony/cache nyholm/psr7 kriswallsmith/buzz
composer require nyholm/psr7
Usage
// if you use another anything else than the recommended you need to add them here
TCGdex :: $cache = /* PSR16 CacheInterface */ ;
TCGdex :: $requestFactory = /* PSR17 RequestFactoryInterface */ ;
TCGdex :: $responseFactory = /* PSR17 ResponseFactoryInterface */ ;
TCGdex :: $client = /* PSR18 ClientInterface */ ;
// initialize the SDK with the language
$tcgdex = new TCGdex ( " en " );
$card = $tcgdex -> fetchCard ( ' 136 ' , ' swsh3 ' );
To setup TCGdex for Symfony you need to add the PSR 18 implementation (as it’s not the default one) and the PSR17 implementation if it’s not the default one
use Symfony\Component\HttpClient\ Psr18Client ;
// if you use another anything else than nyholm/psr7 you need to add them here
TCGdex :: $requestFactory = /* PSR17 RequestFactoryInterface */ ;
TCGdex :: $responseFactory = /* PSR17 ResponseFactoryInterface */ ;
// use Symfony PSR18 client
TCGdex :: $client = new Psr18Client (); /* PSR18 ClientInterface */ ;
// initialize the SDK with the language
$tcgdex = new TCGdex ( " en " );
$card = $tcgdex -> fetchCard ( ' 136 ' , ' swsh3 ' );
You can check in the JSON REST API docs and select the correct tab to see the command specific for your SDK
Source Code
The source code for the SDK is available on Github !