dborsatto/php-giantbomb
最新稳定版本:v2.2.0
Composer 安装命令:
composer require dborsatto/php-giantbomb
包简介
A PHP library that acts as a wrapper for the GiantBomb API.
README 文档
README
This is a library that acts as a wrapper for GiantBomb's API.
Install
Via Composer
$ composer require dborsatto/php-giantbomb
Usage
$apiKey = 'YouApiKey'; // Create a Config object and pass it to the Client $config = new DBorsatto\GiantBomb\Configuration($apiKey); $client = new DBorsatto\GiantBomb\Client($config); // OPTIONAL: use a PSR-16 simple cache pool $cache = new Cache\Adapter\PHPArray\ArrayCachePool(); $client = new DBorsatto\GiantBomb\Client($config, $cache); // Standard query creation process $query = DBorsatto\GiantBomb\Query::create() ->addFilterBy('name', 'Uncharted') ->sortBy('original_release_date', 'asc') ->setFieldList(['id', 'name', 'deck']) ->setParameter('limit', '100') ->setParameter('offset', '0'); $games = $client->find('Game', $query); echo count($games)." Game objects loaded\n"; // These two options are equivalent $game = $client->findOne('Game', Query::createForResourceId('3030-22420')); // The findWithResourceID method is just a shortcut $game = $client->findWithResourceID('Game', '3030-22420'); echo $game->get('name')." object loaded\n"; // These two options are equivalent $query = DBorsatto\GiantBomb\Query::create() ->setParameter('query', 'Uncharted') ->setParameter('resources', 'game,franchise'); $results = $client->find('Search', $query); // The search method is just a shortcut $results = $client->search('Uncharted', 'game,franchise'); echo count($results)." Search objects loaded\n";
For the full option list visit GiantBomb's API doc.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 39.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-08