Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dborsatto/php-giantbomb
A PHP library that acts as a wrapper for the GiantBomb API
https://github.com/dborsatto/php-giantbomb
php php-library
Last synced: 3 months ago
JSON representation
A PHP library that acts as a wrapper for the GiantBomb API
- Host: GitHub
- URL: https://github.com/dborsatto/php-giantbomb
- Owner: dborsatto
- License: mit
- Created: 2015-08-08T17:36:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-17T15:26:36.000Z (over 3 years ago)
- Last Synced: 2024-06-23T11:21:16.955Z (5 months ago)
- Topics: php, php-library
- Language: PHP
- Homepage:
- Size: 89.8 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# php-giantbomb
[![Packagist](https://img.shields.io/packagist/v/dborsatto/php-giantbomb.svg)](https://packagist.org/packages/dborsatto/php-giantbomb)
[![Packagist](https://img.shields.io/packagist/dt/dborsatto/php-giantbomb.svg)](https://packagist.org/packages/dborsatto/php-giantbomb)
[![Packagist](https://img.shields.io/packagist/l/dborsatto/php-giantbomb.svg)](https://packagist.org/packages/dborsatto/php-giantbomb)This is a library that acts as a wrapper for GiantBomb's API.
## Install
Via Composer
``` bash
$ composer require dborsatto/php-giantbomb
```## Usage
``` php
$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](http://www.giantbomb.com/api/documentation).
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.