定制 ptrtn/battlerite 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ptrtn/battlerite

Composer 安装命令:

composer require ptrtn/battlerite

包简介

A php-based client wrapping the battlerite API

README 文档

README

PHP-based SDK for Battlerite API

Build Status Code Coverage Scrutinizer Code Quality

Features

  • Retrieve data for matches (by query)
  • Retrieve detailed data for a specific match
  • Retrieve data for players (by query)
  • Retrieve detailed data for a specific player
  • Retrieve team data for specific players and seasons
  • Retrieve api status

Requirements

  • Php 7.1 or higher

Installing

composer require ptrtn/battlerite-sdk

Usage

Retrieving data can be as simple as one method call. If no search query is specified, API defaults are used instead.

Api status

The following example returns API status, patch version and other data

$client = \PtrTn\Battlerite\Client::create('your-api-key');
$status = $client->getStatus();

Retrieving match data

Retrieving match data using API defaults

$client = \PtrTn\Battlerite\Client::create('your-api-key');
$matches = $client->getMatches();
echo $matches[0]->map->type;
// QUICK2V2

Retrieving team data

$client = \PtrTn\Battlerite\Client::create('your-api-key');
$teams = $client->getTeams(
    TeamsQuery::create()
    ->forPlayerIds(['322'])
    ->forSeason(5)
);

Retrieving detailed match data

$client = \PtrTn\Battlerite\Client::create('your-api-key');
$match = $client->getMatch('AB9C81FABFD748C8A7EC545AA6AF97CC');

Retrieving detailed player data

$client = \PtrTn\Battlerite\Client::create('your-api-key');
$match = $client->getPlayer('934791968557563904');

Custom querying

A custom search query can be used to retrieve the exact data needed.

Matches

For matches the following query options are available:

  • Offset
  • Limit
  • Start date
  • End date
  • Player ids
  • Team names
  • Game modes
  • Ascending sorting
  • Descending sorting
$client = \PtrTn\Battlerite\Client::create('your-api-key');
// Retrieve matches for a specific player for the last 24 hours
$matches = $client->getMatches(
    MatchesQuery::create()
    ->forPlayerIds(['934791968557563904'])
    ->withStartDate(new DateTime('-1 day'))
);

Players

For players the following query options are available:

  • Player name
  • Steam id
  • Player id
$client = \PtrTn\Battlerite\Client::create('your-api-key');
// Retrieve a list of players for a specific player name
$players = $client->getPlayers(
    PlayersQuery::create()
    ->forPlayerNames(['PlakkeStrasser'])
);

Note: up to 6 players (1 per region) can be found for a specific player name.

Teams

For teams the following query options are available:

  • Season
  • Player id
$client = \PtrTn\Battlerite\Client::create('your-api-key');
$teams = $client->getTeams(
    TeamsQuery::create()
    ->forPlayerIds(['322'])
    ->forSeason(5)
);

Caching

When sending a lot of requests, the default rate limit of 10 requests per minute will pose an issue. In order to prevent this, caching can be enabled for the player details and match details endpoints.

// Create client using default filesystem cache
$client = ClientWithCache::create('your-api-key');

Optionally an alternative cache lifetime or caching system implementing the Doctrine\Common\Cache\Cache interface can be configured.

// Create a client using custom configured cache
$client = ClientWithCache::createWithCache(
    'your-api-key',
    new RedisCache(),
    300
);

How do I get an API key?

  1. In order to get an API key you should create a developer account and an app
  2. Once created, log in and browse to https://developer.battlerite.com/apps/your-app
  3. Scroll down to DEVELOPMENT API KEY THIS APP USES, it should look like: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9G9lIiwiYWRtaW4iOnRydWV9G9lIi.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

Api documentation

Documentation for the Battlerite API can be found at http://battlerite-docs.readthedocs.io/en/latest/

ptrtn/battlerite 适用场景与选型建议

ptrtn/battlerite 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 12 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ptrtn/battlerite 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ptrtn/battlerite 我们能提供哪些服务?
定制开发 / 二次开发

基于 ptrtn/battlerite 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-10