GithubHelp home page GithubHelp logo

igdb's Introduction

IGDB (Internet Game Database)

Build Status Built For Laravel License Total Downloads

Introduction

This packages provides a nice and easy wrapper around the IGDB API for use in your Laravel application.

In order to use the IGDB API, you must have a account and key. You can register your app at https://api.igdb.com/.

Installation

Add messerli90/igdb to your composer.json.

"messerli90/igdb": "~1.0"

or

composer require messerli90/igdb

Run composer update to pull down the latest version of the package.

Now open up app/config/app.php and add the service provider to your providers array.

'providers' => array(
    Messerli90\IGDB\IGDBServiceProvider::class,
)

Optionally, add the facade to your aliases array

'IGDB' => \Messerli90\IGDB\Facades\IGDB::class,

Configuration

Add the igdb to your config/services.php array. Set cache to a number of minutes to cache responses.

'igdb' => [
    'key' => 'YOUR_IGDB_KEY',
    'url' => 'YOUR_IGDB_URL',
    'cache' => 0
]

Usage

// Get Game by ID
$game = IGDB::getGame(9630);

// Customize / limit the returned fields
$games = IGDB::getGame(9630, ['name', 'release_dates', 'esrb', 'genres'], $limit = 10, $offset = 0, $order = 'release_dates.date:desc');

// Search Games by name
$games = IGDB::searchGames('fallout');

// Get Character by ID
$character = IGDB::getCharacter(4534);

// Search Characters by name
$characters = IGDB::searchCharacters('fisher');

// Get upcoming releases
$releases = IGDB::getReleases($filters = ['filter[platform][eq]=48', 'filter[date][gt]=1500619813000], $fields = ['*'], $limit = 10, $offset = 0, $order = 'date:asc');

// Get Company by ID
$companies = IGDB::getCompany('ubisoft');

// Search Company by name
$company = IGDB::getCompany(7041);

// Get Franchise by ID
$franchise = IGDB::getFranchise(133);

// Search Franchise by name
$franchises = IGDB::searchFranchises('Harry Potter');

// Get Game Mode by Id
$game_mode = IGDB::getGameMode(1);

// Search Game Modes by name
$game_modes = IGDB::searchGameModes('Single Player');

// Get Genre by ID
$genre = IGDB::getGenre(15);

// Search Genres by name
$genres = IGDB::searchGenres('strategy');

// Get Keyword by ID
$keyword = IGDB::getKeyword(121);

// Search Keyword by name
$keywords = IGDB::searchKeywords('sandbox');

// Get Person by ID
$person = IGDB::getPerson(24354);

// Search People by name
$people = IGDB::searchPeople('Delaney');

// Get Platform by ID
$platform = IGDB::getPlatform(49);

// Search Platforms by name
$platforms = IGDB::searchPlatforms('xbox');

// Get Player Perspective by ID
$player_perspective = IGDB::getPlayerPerspective(7);

// Search Player Perspective by name
$player_perspectives = IGDB::searchPlayerPerspectives('Virtual');

// Get Pulse by ID
$pulse = IGDB::getPulse(20707);

// Fetch latest Pulses
$pulses = IGDB::fetchPulses();

// Get Collection / Series by ID
$collection = IGDB::getCollection(3);

// Search Collections / Series by name
$collections = IGDB::searchCollections('fallout');

// Get Theme by ID
$theme = IGDB::getTheme(39);

// Search Themes by name
$themes = IGDB::searchThemes('warfare');

Format of returned data

The returned JSON data is decoded as a PHP object.

Run Unit Test

If you have PHPUnit installed in your environment, run:

$ phpunit

IGDB API

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

igdb's People

Contributors

2gen avatar dbfx avatar k4kuz0 avatar messerli90 avatar

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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

igdb's Issues

Laravel?

Hi, what ist Laravel?
Do I need this for my simple php script to use this API?

config

there is no config folder ?

Default searchGame() ordering should be blank, not release date

Hey nice API wrapper!,

I noticed that in the following line of code:

public function searchGames($search, $fields = ['*'], $limit = 10, $offset = 0, $order = 'release_dates.date:desc')

You set the default search ordering to be 'release_dates.date:desc'. 9 times out of 10, I think this produces results you don't want, for example, upon searching "The Witcher 3", I get this:

[ { "id": 2933, "name": "Kingdom Hearts III" }, { "id": 13165, "name": "The Guild 3" }, { "id": 12579, "name": "Danganronpa V3: Killing Harmony" }, { "id": 7333, "name": "Crackdown 3" }, { "id": 18980, "name": "Warhammer 40,000: Dawn of War III" }, { "id": 11806, "name": "Dark Cloud 3" }, { "id": 17583, "name": "SpellForce 3" }, { "id": 13215, "name": "Cossacks 3" }, { "id": 13163, "name": "Syberia 3" }, { "id": 11542, "name": "Shenmue III" } ]

Whereby the real result I clearly wanted is absent, since the game is "too old".

I'd recommend changing it to be "null" since the ordering is not a required parameter, but I'm not sure if that will break your code. (I am currently using my own API wrapper).

Expand igdb class

Hi,

maybe it would be helpful, if the methods [getEndpoint, decodeSingle, decodeMultiple, apiGet] will be declared as protected instead of private, to expand the class by extending from it.

Hi.

I have this error when try to do something
Unresolvable dependency resolving [Parameter #0 [ <required> $key ]] in class Messerli90\IGDB\IGDB

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.