evilfreelancer/

steam-api-client

SteamAPI PHP客户端是一个用于与Steam API交互的PHP库。它提供了一种简单的方法来从Steam平台获取数据,例如用户资料、游戏和评论。

dev-main 2023-04-30 17:37 UTC

This package is auto-updated.

Last update: 2024-08-30 01:55:22 UTC


README

注意:此库仍在开发中,尚未准备好投入生产。

SteamAPI PHP客户端是一个用于与Steam API交互的PHP库。它提供了一种简单的方法来从Steam平台获取数据,例如用户资料、游戏和评论。

安装

要安装SteamAPI PHP客户端,只需使用Composer即可

composer require evilfreelancer/steam-api-client

使用

配置

首先,您需要创建一个带有您所需配置的Config对象

use SteamApi\Config;

$config = new Config();
$config->storeUri = 'https://store.steampowered.com';
$config->retries = 5;
$config->retryTimeoutMs = 1000;

然后,创建HttpClient类的实例,并传递您的Config对象

use SteamApi\HttpClient;

$httpClient = new HttpClient($config);

获取Curator评论

要获取特定Curator的评论,可以使用Curator类

// Replace with a valid curator ID
$curatorId = 31790204; // Games-4-Programmers
$curator = $httpClient->store->curator($curatorId);

// Get the total number of reviews for the curator
$totalCount = $curator->getTotalCount();

// Get a limited number of reviews (default: last 10 reviews)
$reviews = $curator->getReviews();

// Get all available reviews
$allReviews = $curator->allReviews();

许可证

此库在MIT许可证下发布。有关详细信息,请参阅LICENSE文件。