johnleider/battlenet-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

johnleider/battlenet-api

最新稳定版本:v2

Composer 安装命令:

composer require johnleider/battlenet-api

包简介

A package to retrieve information from Blizzard's API

README 文档

README

A package for Battle.net's API (http://dev.battle.net/)

Usage

Instantiate the game API you wish to use with your API Key, API Secret and Region

$diablo = new Diablo(
  $key,
  $secret,
  'us',
  'en_US'
);

Example API calls:

// Retrieve Season Leaderboard data
$diablo = new Diablo($key, $secret, 'us', 'en_US');
$diablo->setAccessToken($accessToken);

$barbarian = $diablo->season($season)
	->barbarian()
	->get();
	
$barbarian_hardcore = $diablo->season($season)
	->hardcore()
	->barbarian()
	->get();

$profile = $diablo->careerProfile('battle_tag');
$hero = $diablo->hero('battle_tag', 'id');

Pooling Requests

You can pool multiple requests by chaining requests before calling get().

$diablo = new Diablo($key, $secret, 'us', 'en_US');
$diablo->setAccessToken($accessToken);

$leaderboards = $diablo->season($season)
	->barbarian()
	->crusader()
	->demonhunter()
	->monk()
	->witchdoctor()
	->wizard()
	->team(2)
	->team(3)
	->team(4)
	->get();
	
$profile = $diablo->setRegion('eu')
	->careerProfile($battle_tag)
	->get();
	
foreach ($request->heroes as $hero) {
	$diablo->hero($hero->id);
}

$heroes = $diablo->get();

This will asynchronously request 25 concurrent requests at a time. The response will return as an array of JSON objects. The call will not be made until the get method is called.

统计信息

  • 总下载量: 98
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-11