xklusive / laravel-battlenet-api
Laravel 5 client for Battle.net API
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ^6.2
- illuminate/contracts: ^5.5
- laravel/framework: ^5.5
Requires (Dev)
- orchestra/testbench: ^3.1.4
- phpunit/phpunit: ~6.0
- scrutinizer/ocular: ~1.1
This package is not auto-updated.
Last update: 2024-11-10 01:43:24 UTC
README
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 !