lifeformwp/php-pubg

PHP 7.1 编写的 PUBG API 包装器

1.8.0 2018-11-13 15:59 UTC

This package is auto-updated.

Last update: 2024-09-25 23:00:26 UTC


README

Total Downloads

使用 DTO (匹配、玩家/玩家、状态、遥测、样本) 包装 PUBG API,全面测试覆盖,PHP 7.1 等。

需求

  • PHP >= 7.1

安装

  • 运行 composer require lifeformwp/php-pubg

基本用法

$client = new GuzzleHttp\Client();
$class = new \Lifeformwp\PHPPUBG\PUBGManager($client, 'token');

$data = $class->getMatch('pc-eu', 'abe08f7e-3add-4fd6-9bcd-4aff88fc7adf'); //returns array
$matchObject = $class->hydrate($data, \Lifeformwp\PHPPUBG\PUBGManager::HYDRATE_MATCH); //returns Lifeformwp\PHPPUBG\DTO\Match object

可用方法

  • getMatch([string, required]shard, [string, required]matchId) - 返回关于比赛的数据数组

  • getPlayers([string, required]shard, [array, not required]playerNames, [array, not required]playerIds) - 返回关于玩家数据数组

  • getPlayer([string, required]shard, [string, required]playerId) - 返回关于玩家的数据数组

  • getTelemetry([string, required]shard, [string, required]matchId) - 返回比赛中的遥测数据数组

  • getStatus() - 返回关于 API 状态的数据数组

  • getSamples([string, required]shard) - 返回样本数据数组

  • getSeasons([string, required]shard) - 返回季节数据数组

  • getSeasonDataForPlayer([string, required]shard, [string, required]playerId, [string, required]seasonId) - 返回玩家季节数据数组

  • getTournaments() - 返回关于锦标赛的数据数组

  • getTournament([string, required]tournamentId) - 返回关于锦标赛的数据数组

  • getLeaderboard([string, required]shard, [string, required]gameMode) - 返回关于排行榜的数据数组

  • getMatches([string, required]shard, [array, required]matchesIds) - 返回关于比赛的数据数组

  • getTelemetryByMatch([string, required]telemetryUrl) - 返回给定遥测 URL 的数据数组

  • setClient([ClientInterface, required]client)

  • setToken([string, required]token)

  • hydrate([array, required]data, [string, required]type) - 从给定数组返回对象,type 参数的可能值有:HYDRATE_MATCH, HYDRATE_PLAYERS, HYDRATE_PLAYER, HYDRATE_STATUS, HYDRATE_TELEMETRY 和 HYDRATE_SAMPLES

正在进行中

  • 文档
  • 更灵活的行为