tcgdex/sdk

PHP SDK to communicate with the TCGdex API

2.1.0 2021-12-15 10:35 UTC

README

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 trough PHP

Full API/SDK documentation in progress at https://www.tcgdex.net/docs

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

Usage

Note: a complete documentation is in progress

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');