xklusive/laravel-battlenet-api

Laravel 5 client for Battle.net API

1.1 2018-09-21 09:13 UTC

README

Latest Version on Packagist Software License Build Status Code Quality SensioLabsInsight StyleCI Codacy Badge Total Downloads Average time to resolve an issue Percentage of issues still open

This package allows to call the Battle.net API.

Once installed you can do stuff like this:

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
	//	]
}

Battle.net API key

Before you be able to make requests to the Battle.net API, you need to provide your API key. If you don't have an API key, refer to https://dev.battle.net/docs to get your API key. Without a Battle.net API key, the package will not be functionnal.

Install

You can install the pacakge via composer:

$ composer require xklusive/laravel-battlenet-api

Then this provider must be installed :

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

The last required step is to publish configuration's file in your application with :

$ php artisan vendor:publish --provider="Xklusive\BattlenetApi\BattlenetApiServiceProvider" --tag="config"

Once the config file is published setup the required variables in the .env file :

// .env

BATTLENET_KEY=[YOUR_API_KEY]
BATTLENET_REGION=eu

Congratulations, you have successfully installed Laravel Battle.net API !