New API & PHP API Class

API Discussion
Hello,

is someone developing a php Class for the new released API?

I was thinking about creatiing a new Class like this:


class BlizzardAPI {

private $apiKey = "";
private $server = "";
private $region = "";
private $locale = "";

public function __construct($apiKey,$region = "eu",$server = "nethersturm",$locale = "de_DE"){
$this->apiKey = $apiKey;
$this->server = $server;
$this->region = $region;
$this->locale = $locale;
}

public function getWOWGuildProfile($guildname){
$data = file_get_contents("https://".$this->region.".api.battle.net/wow/guild/".$this->server."/".$guildname."?locale=".$this->locale."&apikey=".$this->apiKey);
return json_decode($data,true);
}

}


Is someone already creating such a class or do you think it´s not worth creating such a handy "Shortcut"-Lib?
ive created a wrapper look down the page a bit and you you should see the post for it or check out https://github.com/Ulminia/blizzard-api-oauth
I'm working on a PHP 5.4+ library for the new Battle.net API: https://github.com/pwnraid/bnet

There are still plenty of endpoints that aren't supported yet and a bunch of other things to do, but here's some sample usage:

use Pwnraid\Bnet\ClientFactory;
use Pwnraid\Bnet\Region;

$factory = new ClientFactory('apikey');
$client = $factory->warcraft(Region::EUROPE);
$toon = $client->characters()->on('Realm')->find('Character', ['feed', 'items']);
$spell = $client->spells()->find(123);
I have a rich Spell API I've built that gives lots more info than the Blizz ones.
http://api.wowguild.co/api/doc/

I just built it, so it could be buggy!
It scrapes wowhead to get the reagents, tools and crafted item. I also have estimated crafting costs for some realms (more to come later).
08/25/2014 10:53 AMPosted by jyggen
I'm working on a PHP 5.4+ library for the new Battle.net API: https://github.com/pwnraid/bnet

There are still plenty of endpoints that aren't supported yet and a bunch of other things to do, but here's some sample usage:

use Pwnraid\Bnet\ClientFactory;
use Pwnraid\Bnet\Region;

$factory = new ClientFactory('apikey');
$client = $factory->warcraft(Region::EUROPE);
$toon = $client->characters()->on('Realm')->find('Character', ['feed', 'items']);
$spell = $client->spells()->find(123);


Maybe I'm wrong but I think it should be:

$client = $factory->warcraft(new Region(Region::EUROPE));
Yeah, I changed the public API around a bit to make the classes less coupled.
Just as a side note, there is a really nice php class to access the api (wow only)
https://sourceforge.net/projects/wowarmoryapi/
The author just updated for the new api.
10/12/2014 08:02 AMPosted by Clausi
Just as a side note, there is a really nice php class to access the api (wow only)
https://sourceforge.net/projects/wowarmoryapi/
The author just updated for the new api.


Correct, I've revived this API. I've added new functionalities and is soon up to par.

/Thomas
DELETED. I posted this in the wrong thread.

Join the Conversation

Return to Forum