caoliangpubg/php-api

v2.0.0 2021-01-22 23:34 UTC

This package is auto-updated.

Last update: 2024-09-23 07:48:17 UTC


README

Latest Stable Version Total Downloads License

PlayerUnknown's Battlegrounds Php Api

安装

通过composer

$ composer require samiaraboglu/pubg-php-api

配置

$config = new Pubg\Config();
$config->setApiKey('{API_KEY}');
$config->setPlatform('{PLATFORM}');

$api = new Pubg\Api($config);

平台: kakao, psn, steam, tournament, xbox

平台区域: pc-as, pc-eu, pc-jp, pc-kakao, pc-krjp, pc-na, pc-oc, pc-ru, pc-sa, pc-sea, pc-tournament, psn-as, psn-eu, psn-na, psn-oc, xbox-as, xbox-eu, xbox-na, xbox-oc, xbox-sa

玩家

使用玩家服务。

$playerService = new Pubg\Player($api);

通过名称或账户ID获取单个玩家。

// by player name
$player = $playerService->get('{PLAYER_NAME}');

// by account id
$player = $playerService->get('{ACCOUNT_ID}');

通过名称或账户ID获取最多6名玩家的集合。

// by players names
$players = $playerService->getAll(['{PLAYER_NAME_1}', '{PLAYER_NAME_2}']);

// by accounts ids
$players = $playerService->getAll(['{ACCOUNT_ID_1}', '{ACCOUNT_ID_2}']);

赛季统计数据

使用赛季服务。

$seasonService = new Pubg\Season($api);

获取可用赛季列表。

$seasons = $seasonService->getAll();

获取单个玩家的赛季信息。

$season = $seasonService->get('{ACCOUNT_ID}', '{SEASON_ID}');

终身统计数据

使用终身服务。

$lifetimeService = new Pubg\Lifetime($api);

获取单个玩家的终身统计数据。

$lifetime = $lifetimeService->get('{ACCOUNT_ID}');

比赛

使用比赛服务。

$matchService = new Pubg\Match($api);

获取单个比赛。

$match = $matchService->get('{MATCH_ID}');

排行榜

使用排行榜服务。

$leaderboardService = new Pubg\Leaderboard($api);

获取游戏模式的排行榜。

$leaderboards = $leaderboardService->get('{GAME_MODE}', {PAGE_NUMBER});

游戏模式: duo, duo-fpp, solo, solo-fpp, squad, squad-fpp

页码: 0, 1

锦标赛

使用锦标赛服务。

$tournamentService = new Pubg\Tournament($api);

获取可用锦标赛列表。

$tournaments = $tournamentService->getAll();

获取单个锦标赛的信息。

$tournament = $tournamentService->get('{TOURNAMENT_ID}');

示例

使用示例服务。

$sampleService = new Pubg\Sample($api);

获取示例比赛列表。

$samples = $sampleService->get();

// date filter
$samples = $sampleService->get('2019-03-29T00:00:00Z');