This is the Pokémon TCG SDK PHP implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io.
composer require jacobknox/pokemon-tcg-sdk-php
See the Guzzle 7 documentation for available options.
Pokemon::Options(['verify' => true]);
Pokemon::ApiKey('<YOUR_API_KEY_HERE>');
$card = Pokemon::Card()->find('xy1-1');
$cards = Pokemon::Card()->where(['set.name' => 'generations'])->where(['supertype' => 'pokemon'])->all();
$cards = Pokemon::Card()->where([
'set.name' => 'roaring skies',
'subtypes' => 'ex'
])->all();
$cards = Pokemon::Card()->where(['types' => ['OR', 'fire', 'water'])->where(['supertype' => 'pokemon'])->all();
$cards = Pokemon::Card()->where([
'types' => ['OR', 'fire', 'water'],
'subtypes' => 'ex'
])->all();
There are four methods to order cards. You may use whichever one suits you. Please note that they will sorted first by the first array/list item then by the second and so on until the end of the array/list.
$cards = Pokemon::Card()->orderBy(['name' => 1, 'number' => -1])->all();
Permitted values to represent ascending: 1, 'ascending', ''. Permitted values to represent descending: -1, 'descending', '-'.
Specify attributes with order indicator ('-' indicates descending, lack thereof indicates ascending)
$cards = Pokemon::Card()->orderBy(['name', '-number'])->all();
$cards = Pokemon::Card()->orderBy(['name,-number'])->all();
$cards = Pokemon::Card()->all();
$cards = Pokemon::Card()->where([
'set.legalities.standard' => 'legal'
])->page(8)->pageSize(100)->all();
$pagination = Pokemon::Card()->where([
'set.legalities.standard' => 'legal'
])->pagination();
$set = Pokemon::Set()->find('base1');
$set = Pokemon::Set()->where(['legalities.standard' => 'legal'])->all();
$set = Pokemon::Set()->page(2)->pageSize(10)->all();
$pagination = Pokemon::Set()->pagination();
$sets = Pokemon::Set()->all();
$types = Pokemon::Type()->all();
$subtypes = Pokemon::Subtype()->all();
$supertypes = Pokemon::Supertype()->all();
$supertypes = Pokemon::Rarity()->all();