jocolopes / steamapi
Steam Web Api 通用集成
dev-master
2015-01-25 19:10 UTC
Requires
- guzzlehttp/guzzle: 5.0.*@dev
Requires (Dev)
- phpunit/phpunit: 4.6.*@dev
This package is not auto-updated.
Last update: 2024-09-28 16:20:39 UTC
README
关于
用于与 Steam Web API 通信的 PHP 包装器
SteamID64 查找器
请参考 http://steamid.co/ 或 http://steamidconverter.com/ 以查找用户 Steam ID。
安装
添加到您的 composer.json
{
"require": {
"jocolopes/steamapi": "dev-master"
}
}
使用方法
用户类
$user = new \SteamApi\User('YOUR-STEAM-KEY', 'THE-STEAMID64');
获取玩家封禁
$user->GetPlayerBans();
// OR
$user->GetPlayerBans('THE-FIRST-STEAMID64,THE-SECOND-STEAMID64,THE-ANY-STEAMID64');
获取玩家概要信息
$user->GetPlayerSummaries();
// OR
$user->GetPlayerSummaries('THE-FIRST-STEAMID64,THE-SECOND-STEAMID64,THE-ANY-STEAMID64');
获取好友列表
$user->GetFriendList();
获取用户组列表
$user->GetUserGroupList();
解析虚荣 URL
$user->ResolveVanityUrl('id-of-user-to-translate-into-steam-id');
// Example
$user->ResolveVanityUrl('pr00fgames'); // Result: 76561197963455129
玩家类
$player = new \SteamApi\Player('YOUR-STEAM-KEY', 'THE-STEAMID64');
获取 Steam 等级
$player->GetSteamLevel();
获取玩家等级详细信息
$player->GetPlayerLevelDetails();
获取徽章
$player->GetBadges();
获取社区徽章进度
$player->GetCommunityBadgeProgress();
获取拥有的游戏
$player->GetOwnedGames();
获取最近玩过的游戏
$player->GetRecentlyPlayedGames();
是否在玩共享游戏
$player->IsPlayingSharedGame($gameId);
新闻类
$news = new \SteamApi\News('YOUR-STEAM-KEY');
获取应用程序的新闻
$news->GetNewsForApp($appId[, $numberOfNews, $maxLength]); // Last 2 arguments are optional
应用程序类
$app = new \SteamApi\App('YOUR-STEAM-KEY');
获取应用程序详细信息
$app->appDetails($appId);
获取地址处的服务器
$app->GetServersAtAddress($address); // Hostname or IP:Port
获取应用程序列表
$app->GetAppList();
检查应用程序是否为最新版本
$app->UpToDateCheck($appId, $appVersion);
用户统计
$stats = new Stats('YOUR-STEAM-KEY', 'THE-STEAMID64');
获取游戏的全球统计数据
$stats->GetGlobalStatsForGame($gameId, array('STATS-NAME'));
// Example
$stats->GetGlobalStatsForGame(17740, array('global.map.emp_isle'));
获取当前玩家数量
$stats->GetNumberOfCurrentPlayers($appId);
获取游戏的模式
$stats->GetSchemaForGame($appId);
获取玩家成就
$stats->GetPlayerAchievements($appId);
获取应用程序的全球成就百分比
$stats->GetGlobalAchievementPercentagesForApp($appId);
获取游戏的用户统计数据
$stats->GetUserStatsForGame($appId);
更多信息
请参考测试文件夹以获取有关如何使用库的更多信息
目标
此库的目标是将 Steam Web API 封装成一个 PHP 对象。
有些方法我计划很快实现。
请随意添加一些缺失的方法,并在本仓库上创建 pull request。
缺失的方法可以通过 swissapiknife 查找。
常见问题解答
我需要什么特殊的东西来使用此库?
您确实需要 PHP 5.4+ 和 composer。您还需要将 vendor/autoload.php
加载到您的项目中。
这在我的框架上会工作吗?
此库是框架无关的,也许您使用的框架需要一些额外的设置。
如果您的框架使用 composer,您应该没问题。但如果您遇到任何问题,请告诉我。
发现了错误,我应该怎么办?
如果您有解决问题的能力,请尽一切可能修复它并创建一个 pull request。
如果您无法修复它,请在 github 上提出一个问题,我或其他人将尝试修复它。