pokemon-tcg / pokemon-tcg-sdk-php
这是宝可梦TCG SDK PHP实现。它是对pokemontcg.io的宝可梦TCG API的包装。
2.1.0
2021-08-10 16:34 UTC
Requires
- php: ^7.3 || ^7.4 || ^8.0
- ext-json: *
- doctrine/inflector: ^2.0
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- dms/phpunit-arraysubset-asserts: ^0.2.1
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-09-18 07:51:15 UTC
README
这是宝可梦TCG SDK PHP实现。它是对pokemontcg.io的宝可梦TCG API的包装。
安装
composer require pokemon-tcg/pokemon-tcg-sdk-php
使用
设置ApiKey和选项
Pokemon::Options(['verify' => true]);
Pokemon::ApiKey('<YOUR_API_KEY_HERE>');
通过id查找卡片
$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()->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();