padarom/battlenet-api-client

An API client for the Battle.net API


License
MIT

Documentation

Battle.net API Client

Build Status Code Quality Latest Release License

This is a wrapper around the Battle.net API. Just tell it your applications API token, and which endpoint/method you want to call and it does the rest for you.

Some methods are not yet implemented, but the library should now be usable. Use at your own risk.

Installation

The preferred installation method is by using Composer.

composer require padarom/battlenet-api-client

Before using it, you need to register composers autoloader so you're able to load the classes:

<?php

require 'vendor/autoload.php';

// The rest of your code...

Usage

To call API methods, you just need to instantiate an Endpoint with its respective Client:

<?php

use Padarom\BattleNet\API\WorldOfWarcraft\WorldOfWarcraftClient;
use Padarom\BattleNet\API\WorldOfWarcraft\Endpoints\DataResources;

$client = new WorldOfWarcraftClient('your-client-id', 'eu');
$endpoint = new DataResources($client);

$classes = $endpoint->callMethod('characterClasses');

If you need to use a different locale, you can specify it by calling the method withLocale($locale) on your client:

$endpoint = new DataResources($client->withLocale('de_DE'));

What this is not

This is not an OAuth Client or wrapper. If you wish to access the OAuth 2 section of the Battle.net API, you can take a look at my Socialite Provider that implements exactly that. These two libraries work great together, so you can use them both in the same project without any issues.