PHP code example of francis-schiavo / blizzard_api

1. Go to this page and download the library: Download francis-schiavo/blizzard_api 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/ */

    

francis-schiavo / blizzard_api example snippets




use BlizzardApi\Enumerators\Region;

BlizzardApi\Configuration::$apiKey = '<YOUR APPLICATION ID>';
BlizzardApi\Configuration::$apiSecret = '<YOUR APPLICATION SECRET>';
BlizzardApi\Configuration::$region = Region::US;

$api_client = new \BlizzardApi\Wow\GameData\PlayableRace();
$data = $api_client->index();

echo(print_r($data));

# PHP Redis module
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->select(8);

# BlizzardApi\Cache
use BlizzardApi\Cache\RedisCache;
$cache = new RedisCache($redis);

# Pass the constructor `cache` parameter.
$api_client = new \BlizzardApi\Wow\GameData\PlayableRace(cache: $cache);
$data = $api_client->index();

# Pass the constructor `cache` parameter.
$api_client = new \BlizzardApi\Wow\GameData\Item(cache: $cache);
$data = $api_client->search(function($queryOptions) {
    $searchOptions->where('name.en_US', 'Booterang')->order_by('id');
});