Code Monkey home page Code Monkey logo

igdb's Introduction

IGDB API PHP Wrapper

Introduction

The wrapper's main purpose is to provide a simple solution to fetch data from IGDB's database using PHP.

To have access to IGDB's database you have to register a Twitch Account and have your own client_id and access_token. Refer to the Account Creation and Authentication sections of the IGDB API Documentation for details.

Now there is a utility class called IGDBUtils which contains an authenticate method to help you generate your access token! Refer to the documentation for details!

For a better understanding of the wrapper, there are several example scripts in the documentation.

Documentation

The documentation is now published to github pages. You can find it here:

http://enisz.github.io/igdb

igdb's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

igdb's Issues

License

Hey @enisz,
this is a really nice class and i'm currently using it in a project for university.
In this regard i'd like to ask you to include a license in this repo so i could use it in the final thing if possible. If you're against that, that's completely alright, just wanted to ask. Thanks!

Api V4

Hello, do you have plans to upgrade your class to v4?

Version for v3

Hello,

is there any chance that you will release upgraded version for v3 API?

Fixing multiquery and prepare Query Builder to build multiqueries

Currently there is a typo in the name of the multiquery method in the wrapper class.

igdb/src/IGDB.php

Lines 861 to 869 in a18a3e9

public function mutliquery($endpoint, $result_name, $query = null) {
return $this->_exec_query(
$this->construct_url(
"multiquery",
false
),
"query $endpoint \"$result_name\" {\n" . (is_null($query) ? "" : $query) . "\n};"
);
}

Also IGDBQueryBuilder should be altered to produce multiquery strings.

More fields in Game endpoint

Hello,
I'm using this api, it's good.
But it misses some field such language for a game

Can you add it?

Thanks

Remove debug message

There is a line in the code which prints the constructed url before each query.

This is a debugging leftover, needs to be removed.

v5

The code needs some optimization and refactoring. New endpoints are available on IGDB API which needs to be synchronized to the wrapper.

For these changes the documentation needs to be updated. The docs are rewritten in Angular with PWA support.

Issues with slug field

Hello,

I'm try to get data with filter: where slug = 'starcraft-brood-war', but I'm receiving the following error:

Uncaught Exception: Error 400: Expecting a STRING as input, surround your input with quotes starting at 'starcraft' expecting {'{', 'f', '(', '[', 'true', 't', 'false', 'null', 'n'

My code is:

require './src/IGDB.php';
$extAPI = new IGDB('xxxxx');
$options = array('fields' => 'id, slug, name','where' => array('field' => 'slug', 'postfix' => '=', 'value' => 'starcraft-brood-war'));
$result = $extAPI->game($options);

Could you help me?

Regards.

_exec_query returns object, not array

_exec_query() is returning an object, not an array..

to fix, add true as second argument to json_decode:
$result = json_decode(curl_exec($this->curl_handler), true);

"cover" is an integer instead of an object

Hello,

Considering the following options :

$options` = array(
        'search' => 'uncharted 4',
        'fields' => array(
            'id',
            'name',
            'cover'
        )
);

I get these results :

array(5) {
  [0]=>
  object(stdClass)#2 (3) {
    ["id"]=> int(7331)
    ["cover"]=> int(81917)
    ["name"]=> string(26) "Uncharted 4: A Thief's End"
  }
  [1]=>
  object(stdClass)#3 (2) {
    ["id"]=> int(136686)
    ["name"]=> string(43) "Uncharted 4: A Thief's End - Deluxe Edition"
  }
  [2]=>
  object(stdClass)#4 (3) {
    ["id"]=> int(41874)
    ["cover"]=> int(100142)
    ["name"]=> string(42) "Uncharted 4: A Thief's End Special Edition"
  }
  [3]=>
  object(stdClass)#5 (3) {
    ["id"]=> int(41879)
    ["cover"]=> int(110424)
    ["name"]=> string(57) "Uncharted 4: A Thief's End Libertalia Collector's Edition"
  }
  [4]=>
  object(stdClass)#6 (3) {
    ["id"]=> int(112090)
    ["cover"]=> int(69356)
    ["name"]=> string(18) "Uncharted Water IV"
  }
}

The field "cover" is an integer instead of an object like described in your documentation, am I doing anything wrong ?

Here's the full code :

require 'class.igdb.php';

$IGDB = new IGDB("<client_id>", "<token>");

$options = array(
	'search' => 'uncharted 4',
	'fields' => array(
		'id',
		'name',
		'cover'
	)
);

try {
	$result = $IGDB->game($options);

	echo "<pre>";
	var_dump($result);
	echo "</pre>";
}

catch (Exception $e) {
	echo $e->getMessage();
}

Thanks!

Time to beat

Hey, I noticed that the time_to_beat field has been removed from the games endpoint. How can I access this data now, given a game ID?

Time to beat and image

How do I request time to beat info and logos/thumbnails from the game?
I'm working on a project where I need to request this data,

-Ruben

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.