2017 © Pedro Peláez
 

library battlenet-d3

An API (written in PHP) for accessing Battle.net Diablo 3 REST service.

image

kshabazz/battlenet-d3

An API (written in PHP) for accessing Battle.net Diablo 3 REST service.

  • Tuesday, December 8, 2015
  • by b01
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

Description

A library, written in PHP, for accessing Battle.net Diablo 3 REST service., (*1)

This API provides a client for accessing Diablo 3 profiles, heroes, and items; which require an API key and battle-tag. There are also a few object models for: Profile, Hero, Item, and Skill (Active and Passive)., (*2)

Requirements

  • PHP 5.4 - 5.6

Installation

Add to your composer.json, (*3)

"require": {
    "kshabazz/battlenet-d3": "^1.2"
}

Summary

You can either get the raw JSON data returned from Battle.Net or use some simple models that this library provides., (*4)

Examples for Retrieving data (as JSON) from Battle.net

use
    \Kshabazz\Slib\HttpClient,
    \Kshabazz\BattleNet\D3\Connections\Http as D3_Http,
    \Kshabazz\BattleNet\D3\Profile as D3_Profile;

// An API key and Battle.Net Tag are required for all request.
$apiKey       = 'apiKeyFromMashery';
$battleNetTag = 'msuBREAKER#1374';
$heroId       = 3955832;
$itemHash     = 'item/CioI4YeygAgSBwgEFcgYShEdhBF1FR2dbLMUHape7nUwDTiTA0'
              . 'AAUApgkwMYkOPQlAI';

// Get an HTTP client, currently only my custom HTTP client works.
$httpClient = new HttpClient();

// Initialize a battle.net HTTP client.
$d3Client = new D3_Http( $apiKey, $battleNetTag, $httpClient );

// Get the profile for the Battle.net tag (this will be the raw JSON).
$profileJson = $d3Client->getProfile();

// Get the Hero (again, this will be the raw JSON).
$heroJson = $d3Client->getHero( $heroId );

// Get an item (and again, this will be the raw JSON).
// Get the item from Battle.net.
$itemJson = $d3Client->getItem( $itemHash );

var_dump(
    "Profile:" . $profileJson,
    "\nHero:" . $heroJson,
    "\nItem" . $itemJson
);

Examples Using Models (Profile/Hero/Item)

The following examples show how to use the models this library provides., (*5)

getProfile();

// Get a hero from Battle.net and return a Hero model.
$hero = $d3Client->getHero( $heroId );

// Get an item from Battle.net and return an Item Model.
$item = $d3Client->getItem( $itemHash );

var_dump( $profile, $hero, $item );
```

### Example using factory methods

```php
itemsHashesBySlot();

// Get the item from Battle.net.
$itemJson = $d3Client->getItem( $heroItemHashes['mainHand'] );

// Returns an Array.
var_dump( $profile->heroes() );
var_dump( $profile->json() );
?>

Live Examples

You can see this library in use here: http://d3a.kshabazz.net/, (*6)

Quick links to live examples: * [http://d3a.kshabazz.net/get-profile.php?battleNetId=msuBREAKER%231374(profile)] * [http://d3a.kshabazz.net/get-profile.php?battleNetId=msuBREAKER%231374(profile)] * [http://d3a.kshabazz.net/get-profile.php?battleNetId=msuBREAKER%231374(profile)], (*7)

The Versions

08/12 2015

dev-master

9999999-dev

An API (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest web blizzard diablo 3

19/10 2015

1.3.0

1.3.0.0

An API (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest web blizzard diablo 3

06/04 2015

1.2.2

1.2.2.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

04/04 2015

1.2.1

1.2.1.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

31/01 2015

1.2.0

1.2.0.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

06/01 2015

1.1.5

1.1.5.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

06/01 2015

1.1.4

1.1.4.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

06/01 2015

1.0.4

1.0.4.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

06/01 2015

1.0.3

1.0.3.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

06/01 2015

1.0.2

1.0.2.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

05/01 2015

1.0.1

1.0.1.0

An interface (written in PHP) for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

rest interface blizzard diablo 3

04/01 2015

1.0.0

1.0.0.0

A PHP library for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

diablo 3

24/12 2014

0.1.1

0.1.1.0

A PHP library for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

diablo 3

22/12 2014

0.1.0

0.1.0.0

A PHP library for accessing Battle.net Diablo 3 REST service.

  Sources   Download

MIT

The Requires

 

The Development Requires

diablo 3

30/11 2014

0.0.1

0.0.1.0

A PHP library for accessing Battle.net D3 API.

  Sources   Download

MIT

The Requires

 

The Development Requires

diablo 3