r6api/client
Composer 安装命令:
composer require r6api/client
包简介
Client for the Rainbow 6 Siege stats API
README 文档
README
Installation
You can install the library via Composer. Run the following command:
composer require r6api/client
This will install the client without the needed HTTP client. We suggest you to install:
php-http/curl-clientSimpler if you have no HTTP client on your project.php-http/guzzle6-adapterIf you already use guzzle, I suggest you using this package.
To use the library, use Composer's autoload:
require_once __DIR__. '/vendor/autoload.php';
Getting Started
Simple usage to get someone profile:
require_once __DIR__.'/vendor/autoload.php'; use R6API\Client\ClientBuilder; use R6API\Client\Api\Type\PlatformType; $builder = new ClientBuilder(); $builder->setCacheItemPool($cacheItemPool); // accept PSR-6 adapter (not mandatory) $client = $builder->buildAuthenticated('%email%', '%password%');
Documentation
Profile
Look for profile of an user called panda_______
$profiles = $client->getProfileApi()->get(PlatformType::PC, 'panda_______');
| Parameters | Value | Checks |
|---|---|---|
$platform |
Platform to look at | Check \R6API\Client\Api\Type\PlatformType |
$value |
Value to search | No real restrictions here |
$key |
Key to search | Possible values are: nameOnPlatform, idOnPlatform, userId |
$profiles will contains an array of Profile model:
class Profile { /** * @var \Ramsey\Uuid\Uuid */ public $profileId; /** * @var \Ramsey\Uuid\Uuid */ public $userId; /** * @var string * @see \R6API\Client\Api\Type\PlatformType */ public $platformType; /** * @var \Ramsey\Uuid\Uuid */ public $idOnPlatform; /** * @var string */ public $nameOnPlatform; }
Progression
Progression for user we searched in Profile example:
$progressions = $client->getProgressionApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527']);
| Parameters | Value | Checks |
|---|---|---|
$platform |
Platform to look at | Check \R6API\Client\Api\Type\PlatformType |
$profileIds |
Profiles to search | Search by profileId, each one should be UUID |
$progressions will contains an array of Progression model:
class Progression { /** * @var int */ public $xp; /** * @var Uuid */ public $profileId; /** * @var int */ public $lootboxProbability; /** * @var int */ public $level; public function getLootboxProbabilityPercent(): float; }
Rank
Rank for user we searched in Profile example:
$response = $client->getRankApi()->get(PlatformType::PC, RegionType::EUROPE, SeasonType::CURRENT, ['575b8c76-a33a-4c19-9618-d14b9343d527']);
| Parameters | Value | Checks |
|---|---|---|
$platform |
Platform to look at | Check \R6API\Client\Api\Type\PlatformType |
$region |
Region to filter | Check \R6API\Client\Api\Type\RegionType |
$season |
Season to look at | Check \R6API\Client\Api\Type\SeasonType |
$profileIds |
Profiles to search | Search by profileId, each one should be UUID |
$response will contains an array of Rank model:
class Rank { /** * @var string */ public $boardId; /** * @var int */ public $pastSeasonsAbandons; /** * @var \DateTime */ public $updateTime; /** * @var float */ public $skillMean; /** * @var int */ public $abandons; /** * @var int */ public $season; /** * @var string */ public $region; /** * @var Uuid */ public $profileId; /** * @var int */ public $pastSeasonsLosses; /** * @var float */ public $maxMmr; /** * @var float */ public $mmr; /** * @var int */ public $wins; /** * @var float */ public $skillStdev; /** * @var int */ public $rank; /** * @var int */ public $losses; /** * @var int */ public $nextRankMmr; /** * @var int */ public $pastSeasonsWins; /** * @var int */ public $previousRankMmr; /** * @var int */ public $maxRank; public function getWinLosseRate(): float; }
Statistic
Statistic for user we searched in Profile example:
$statistics = [ StatisticType::CASUAL_TIMEPLAYED, StatisticType::CASUAL_MATCHPLAYED, StatisticType::CASUAL_MATCHWON, StatisticType::CASUAL_MATCHLOSTS, StatisticType::CASUAL_KILLS, StatisticType::CASUAL_DEATH ]; $response = $client->getStatisticApi()->get(PlatformType::PC, ['575b8c76-a33a-4c19-9618-d14b9343d527'], $statistics);
| Parameters | Value | Checks |
|---|---|---|
$platform |
Platform to look at | Check \R6API\Client\Api\Type\PlatformType |
$profileIds |
Profiles to search | Search by profileId, each one should be UUID |
$statistics |
Statistic to filter | Check \R6API\Client\Api\Type\StatisticType, this is an array |
$response will contains an array of Statistic model:
class Statistic
{
/**
* @var Uuid
*/
public $profileId;
/**
* @var array
*/
public $statistics;
}
Understand that $statistics array will contains all responses with StatisticType as key and corresponding value as value ;)
r6api/client 适用场景与选型建议
r6api/client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 r6api/client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 r6api/client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-23