PHP code example of mrcorex / battlenet-api

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

    

mrcorex / battlenet-api example snippets


\BattleNet\Config::setApiKey($key);
\BattleNet\Config::setServer(\BattleNet\Server::EU);
\BattleNet\Config::setLocale(\BattleNet\Locale::EN_GB);

\BattleNet\Config::setCachePath('/path/to/my/cache');

$data = new \BattleNet\Warcraft\Data();
$characterRaces = $data->getCharacterRaces();

$data = new \BattleNet\Diablo\Data();
$blacksmith = $data->getArtisanBlacksmith();

$data = new \BattleNet\StarCraft\Data();
$rewards = $data->getRewards();

\BattleNet\Config::clearCache('wow');