heroespatchnotes/sdk 问题修复 & 功能扩展

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

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

heroespatchnotes/sdk

Composer 安装命令:

composer require heroespatchnotes/sdk

包简介

PHP SDK for Heroes of the Storm

README 文档

README

PHP SDK for Heroes of the Storm

Coverage Status

Installation

  1. Add the heroes-data repository to your composer.json, e.g.:
	"repositories": [
		{
			"type": "vcs",
			"url": "https://github.com/heroespatchnotes/heroes-data"
		}
	],
  1. Install with Composer: > composer require heroespatchnotes/sdk

Description

Heroes is an SDK written in PHP to facilitate access to community resources for Blizzard's MOBA, Heroes of the Storm.

Game Data

Game data is extracted and maintained by koliva8245 and published under the Heroes Tool Chest at heroes-data. The SDK offers convenient discovery and class wrapping for the raw JSON files on two different levels: Providers and Entities.

Providers

Providers locate and load the JSON-encoded data into convenience shared instances. You can think of a Provider as the "database connection" for game data. Because they load into entire files into memory the Provider can only be instantiated through its static get() method to ensure a single, shared instance. Providers are file- and patch-specific and come in two flavors. Provider contents may be accessed by their JSON keys or in their entirety with the getContent() method.

DataProvider

A DataProvider accesses game data from the data subdirectories of a patch. Each DataProvider requires a $group corresponding to the data file, and a $patch for the version of data to use.

Note: Omitting $patch will default to the latest available. You may always check a Provider's patch by its getPatch() method.

Available groups are defined as class constants on the DataProvider class:

const ANNOUNCER         = 'announcer';
const BANNER            = 'banner';
const BEHAVIORVETERANCY = 'behaviorveterancy';
const EMOTICON          = 'emoticon';
const EMOTICONPACK      = 'emoticonpack';
const HERO              = 'hero';
const HEROSKIN          = 'heroskin';
const MATCHAWARD        = 'matchaward';
const MOUNT             = 'mount';
const PORTRAIT          = 'portrait';
const PORTRAITPACK      = 'portraitpack';
const REWARDPORTRAIT    = 'rewardportrait';
const SPRAY             = 'spray';
const UNIT              = 'unit';
const VOICELINE         = 'voiceline';

StringProvider

A StringProvider accesses game strings from the gamestrings subdirectories of a patch. Each StringProvider requires a $group corresponding to the locale, and a $patch for the version of data to use.

Note: Omitting $patch will default to the latest available. You may always check a Provider's patch by its getPatch() method.

Available groups are defined as class constants on the StringProvider class:

const LOCALE = [
	'Germany' => 'dede',
	'USA'     => 'enus',
	'Spain'   => 'eses',
	'Mexico'  => 'esmx',
	'France'  => 'frfr',
	'Italy'   => 'itit',
	'Korea'   => 'kokr',
	'Poland'  => 'plpl',
	'Brazil'  => 'ptbr',
	'Russia'  => 'ruru',
	'China'   => 'zhcn',
	'Taiwan'  => 'zhtw',
 ];

Examples

// Hero data, latest patch
$heroes = DataProvider::get('hero');
echo $heroes->Abathur->life->amount; // "685.0"

// Skin data from a previous patch
$skins = DataProvider::get('heroskin', '2.48.4.77406');
var_dump($skins->DemonHunterWinter);
array(
    "hyperlinkId": "WintersHelperValla",
    "attributeId": "Dhu5",
    "rarity": "Legendary",
    "releaseDate": "2017-12-12",
    "features": [
      "ThemedAbilities",
      "ThemedAnimations"
    ],
)

// English game strings, latest patch
$strings = StringProvider::get('enus');
echo $strings->gamestrings->unit->descriptino->Abathur; // "A unique Hero that can manipulate the battle from anywhere on the map."

// French game strings, previous patch
$older = StringProvider::get(StringProvider::FRANCE, '2.49.2.77981');
echo $older->gamestrings->abiltalent->$tassadarTalentId->name; // "Phase dimensionnelle"
// 

Entities

Entities build on Providers to simplify access to common data components. Like Providers Entities include access to the underlying JSON content, but they also have component-specific methods for many endpoints.

Entities are created by using the corresponding Factory, which is patch- and locale- specific:

// Tassadar, pre-rework, in French
$heroes   = new HeroFactory(StringProvider::LOCALE['France'], '2.49.2.77981');
$tassadar = $heroes->get('Tassadar');
foreach ($tassadar->abilities() as $ability)
{
	echo $ability->name; // e.g. "Phase dimensionnelle"
}

Note: See the API docs for details on each Entity.

统计信息

  • 总下载量: 3.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固