PHP code example of xklusive / laravel-battlenet-api

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

    

xklusive / laravel-battlenet-api example snippets


use Xklusive\BattlenetApi\Services\WowService;

public function index(WowService $wow)
{
	$achievement = $wow->getAchievement(2144);

	dd($achievement);

	//Ouput: 
	//Collection {#236 ▼
  	//	#items: array:10 [▼
	//	    "id" => 2144
	//	    "title" => "Voyages au bout du monde"
	//	    "points" => 50
	//	    "description" => "Accomplir les hauts faits des évènements mondiaux listés ci-dessous."
	//	    "reward" => "Récompense : proto-drake pourpre"
	//	    "rewardItems" => array:1 [▶]
	//	    "icon" => "achievement_bg_masterofallbgs"
	//	    "criteria" => array:8 [▶]
	//	    "accountWide" => true
	//	    "factionId" => 2
	//	]
}


// config/app.php
'providers' => [
	...
    Xklusive\BattlenetApi\BattlenetApiServiceProvider::class,
];

// .env

BATTLENET_KEY=[YOUR_API_KEY]
BATTLENET_REGION=eu