PHP code example of messerli90 / igdb

1. Go to this page and download the library: Download messerli90/igdb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

messerli90 / igdb example snippets


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

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

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

// 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');