Skip to content

tcgdex/php-sdk

Repository files navigation

TCGdex Main Image

Packagist Version NPM Downloads npm version the TCGdex PHP SDK is released under the MIT license. the TCGdex PHP SDK's automated builds. Discord Link

TCGdex PHP SDK

This is the SDK used to communicate with the Open source TCGdex API using PHP

Full API/SDK documentation in progress here

Getting Started

install the SDK using:

composer require tcgdex/sdk
# if you have no PSR 16/17/18 implementations add the following packages
composer require symfony/cache nyholm/psr7 kriswallsmith/buzz
# they will be automaticly setup for the project
# symfony/cache      === PSR16
# nyholm/psr7        === PSR17
# kriswallsmith/buzz === PSR18

Quick usage

use TCGdex\TCGdex;

// Is you are using your own PSRs implementations add theses before loading the class
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('1', 'Sword & Shield');