2017 © Pedro Peláez
 

library giantbomb-php-api

A PHP library for interacting with the GiantBomb API

image

giantbomb/giantbomb-php-api

A PHP library for interacting with the GiantBomb API

  • Monday, October 6, 2014
  • by aequasi
  • Repository
  • 2 Watchers
  • 15 Stars
  • 2,913 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

GiantBomb.com PHP Api Wrapper

Requirements

Installation

In your project root, run the following:, (*1)

composer require giantbomb/giantbomb-php-api dev-master

This will create a vendor directory (if you dont already have one), and set up the autoloading classmap., (*2)

Usage

Once everything is installed, you should be able to load the composer autoloader in your code, and go from there!, (*3)

Here is a very simple example:, (*4)

require __DIR__ . '/vendor/autoload.php';

use \GiantBomb\Client\GiantBombClient;

$config = array( 
    'apiKey' => 'your-api-key',
    'cache'  => array(
        'type'    => 'redis', // Or memcached
        'servers' => array( array( 'host' => 'localhost', 'port' => 6397, 'timeout' => 0 ) ), // weight is also a parameter for memcached
        'persistent' => true
    )
);
/**
Memcached also has the "options" parameter for specifiying Memcached options (via constants)
Redis also has the "password" parameter for auth, and "dbindex" for specifying your db 
*/


$client = GiantBombClient::factory( $config );


$requestArgs = array(
    'limit'  => 100, // Max of 100,
    'offset' => 0,   // Default is 0
//  'field_list' => 'name', // Default is not set
//  'sort'   => 'name|asc', // Default is not set
//  'filter' => 'name:portal 2', // Default is not set
);

// Depending on the query, there are different options afailable. Check out the [service description][3] for more information.

$response = $client->getGames( $requestArgs );

if( $response->getStatusCode() === 1 ) {
    printf( "There are %d total results. Currently showing %d, starting at %d.\n<br /><br />", $response->getNumberOfTotalResults(), $response->getNumberOfPageResults(), $response->getOffset() );
    $games = $response->getResults();
    // HUGE dump. Careful
    //var_dump( $games );

    // Get more info on a single game
    $game = $games->get( 0 )->getDetail()->getResults();

    // All functions are magic functions based on the camel case of the key from the API result. This goes for anything returned from the API
    printf( "Game: %s<br />", $game->getName() );
} else {
    printf( "There was an error: %s", $response->getError() );
}

If you have any questions, feel free to make an issue, and I'll help you out!, (*5)

Contribution

If you want to help out, just make a pull request!, (*6)

Bitdeli Badge, (*7)

The Versions

06/10 2014

dev-master

9999999-dev http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

27/12 2013

1.3.1

1.3.1.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

27/12 2013

1.3.0

1.3.0.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

27/12 2013

1.2.4

1.2.4.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

19/12 2013

1.2.3

1.2.3.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

19/12 2013

1.2.2

1.2.2.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

30/11 2013

1.2.1

1.2.1.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

30/11 2013

1.2.0

1.2.0.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

27/11 2013

1.1.0

1.1.0.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb

26/11 2013

1.0.0

1.0.0.0 http://www.giantbomb.com/api/

A PHP library for interacting with the GiantBomb API

  Sources   Download

Apache V2

The Requires

 

The Development Requires

giantbomb