PHP code example of johnleider / battlenet-api

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

    

johnleider / battlenet-api example snippets


$diablo = new Diablo(
  $key,
  $secret,
  'us',
  'en_US'
);

// Retrieve Season Leaderboard data
$diablo = new Diablo($key, $secret, 'us', 'en_US');
$diablo->setAccessToken($accessToken);

$barbarian = $diablo->season($season)
	->barbarian()
	->get();
	
$barbarian_hardcore = $diablo->season($season)
	->hardcore()
	->barbarian()
	->get();

$profile = $diablo->careerProfile('battle_tag');
$hero = $diablo->hero('battle_tag', 'id');

$diablo = new Diablo($key, $secret, 'us', 'en_US');
$diablo->setAccessToken($accessToken);

$leaderboards = $diablo->season($season)
	->barbarian()
	->crusader()
	->demonhunter()
	->monk()
	->witchdoctor()
	->wizard()
	->team(2)
	->team(3)
	->team(4)
	->get();
	
$profile = $diablo->setRegion('eu')
	->careerProfile($battle_tag)
	->get();
	
foreach ($request->heroes as $hero) {
	$diablo->hero($hero->id);
}

$heroes = $diablo->get();