承接 sjaakmoes/dotapi2 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sjaakmoes/dotapi2

Composer 安装命令:

composer require sjaakmoes/dotapi2

包简介

PHP DotA 2 API Client

README 文档

README

Build Status Dependency Status Test Coverage Code Climate SensioLabsInsight

Dota 2 API Wrapper for PHP

Reference

Installation

This module can be installed with Composer. Add the dotapi2 package to your composer.json file:

{
    "require": {
        "sjaakmoes/dotapi2": "~1.0"
    }
}

You will also need a Steam API key, you can get one at http://steamcommunity.com/dev/apikey.

Configuration

// Set your Steam API key
Client::setDefaultKey('your_api_key_here');

// Create wrapper
$client = new Client();

Supported Endpoints

getMatchHistory

Gets a filtered match history

$filter = new Filters\Match();
$filter->setGameMode(GameModes::CAPTAINS__MODE);
$filter->setMinimumPlayers(10);
$filter->setAccountId(22785577);

// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchHistory($filter);

// Turns response into a Match collection
$matchCollection = $response->getCollection('Match');

// Loops through all the found matches and dispays the start time.
foreach ($matchCollection as $match) {
    echo $match->getStartTime()->format('d-m-Y H:i:s') . PHP_EOL;
}

getMatchHistoryBySequenceNumber

Gets a list of matches ordered by sequence number

// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchHistoryBySequenceNumber(new Filters\MatchSequence(2040184605, 10));

// Turns response into a Match collection
$matchCollection = $response->getCollection('Match');

// Loops through all the found matches and dispays the start time.
foreach ($matchCollection as $match) {
    echo $match->getStartTime()->format('d-m-Y H:i:s') . PHP_EOL;
}

getMatchDetails

Gets detailed information about a specific match

// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchDetails(new Filters\MatchDetails(2197925777));

// Turns response into a DetailedMatch collection
$match = $response->getEntity('DetailedMatch');

// Get Dire players
$direPlayers = $match->getPlayers()->getDire();

// Get a specific player
$specificPlayer = $match->getPlayers()->getById(22785577);
$specificPlayerHero = $specificPlayer->getHeroId();
$specificPlayerKills = $specificPlayer->getKills();

// Get Picks and Bans sequence if matchtype has picks and bans
$pickBanSequence = $match->getPicksBans();

getLeagueListing

Get information about DotaTV-supported leagues.

$response = $client->getLeagueListing();

getLiveLeagueGames

Get a list of in-progress league matches, as well as details of that match as it unfolds.

$response = $client->getLiveLeagueGames();

getScheduledLeagueGames

Get a list of scheduled league games coming up.

$response = $client->getScheduledLeagueGames();

getFantasyPlayerStats

Get fantasy player stats

// Puppey (87278757) in The Shanghai Major (4266)
$response = $client->getFantasyPlayerStats(new Filters\FantasyPlayerStats(4266, 87278757));

getPlayerOfficialInfo

Get official player information.

// Puppey (87278757)
$response = $client->getPlayerOfficialInfo(new Filters\AccountId(87278757));

getBroadcasterInfo

Get broadcaster info with the 64-bit Steam ID. If you need to convert, check Steam ID Conversion.

// Requires the 64-bit Steam ID of a broadcaster.
$response = $client->getBroadcasterInfo(new Filters\BroadcasterInfo(76561197997412731));

getActiveTournamentList

Gets list of active tournament

$response = $client->getActiveTournamentList();

getTeamInfo

Get team info

// Get team info for Team Secret (1838315). Filter is optional.
$response = $client->getTeamInfo(new Filters\TeamInfo(1838315));

getTopLiveGame

Get the top live games.

$response = $client->getTopLiveGame(new Filters\TopLiveGame(0));

getEventStatsForAccount

Retrieve event statistics for account.

// Get stats for account 22785577 at The Shanghai Major (4266)
$response = $client->getEventStatsForAccount(new Filters\EventStats(4266, 22785577));

getRealTimeStats

Retrieve real time stats about a match with a server steam id. You need a steam server id to get statistics, the top live games and some other tournament endpoint provide these for a match.

$response = $client->getRealTimeStats(new Filters\RealTimeStats(steam_server_id_here));

getGameItems

Get a list of Dota2 in-game items.

$response = $client->getGameItems();

getItemIconPath

Get the CDN path for a specific icon.

$response = $client->getItemIconPath(new Filters\ItemIconPath('enchanted_manglewood_staff', IconType::LARGE));

getSchemaUrl

Get the URL to the latest schema for Dota 2.

$response = $client->getSchemaUrl();

getHeroes

Get a list of heroes.

$response = $client->getHeroes();

getRarities

Get item rarity list.

$response = $client->getRarities();

getTournamentPrizePool

Get the current pricepool for specific tournaments.

$response = $client->getTournamentPrizePool();

Custom endpoint

You can also contact a custom endpoint on the Steam API:

$response = $client->get('IEconDOTA2_570/GetGameItems/v1', array|Filters\Filter $parameters);

Steam ID Conversion

If you have the GMP extension installed, Dotapi2 will allow you to convert 32-bit to 64-bit ID's and the other way around.

To convert a 32-bit ID:

$steamId = UserId::to64Bit('22785577'); // 76561197983051305

To convert a 64-bit ID:

$accountId = UserId::to32Bit('76561197983051305'); // 22785577

sjaakmoes/dotapi2 适用场景与选型建议

sjaakmoes/dotapi2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 126 次下载、GitHub Stars 达 6, 最近一次更新时间为 2016 年 04 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「steam」 「dota」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-29