Zum Inhalt springen

The PHP SDK

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Packagist VersionGithub starsNPM DownloadsCoveragethe TCGdex PHP SDK's automated builds.

Installation

  1. Install the SDK using Composer

    Terminal window
    composer require tcgdex/sdk
  2. if you don’t have the PSRs 16,17 & 18 implementations, you can quickly add them using thie command

    Terminal window
    composer require symfony/cache nyholm/psr7 kriswallsmith/buzz

Usage

// import the package
use TCGdex\TCGdex;
// Is you are using your own PSRs implementations add them here before loading the class
// else TCGdex will try to load the one installed on step 2
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");
// Fetch the cards !
$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 !