fkrzski/laravel-steam-api-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

fkrzski/laravel-steam-api-sdk

最新稳定版本:0.1.0

Composer 安装命令:

composer require fkrzski/laravel-steam-api-sdk

包简介

Laravel bridge for fkrzski/php-steam-api-sdk — service provider, Steam facade and test fakes for the Steam Web API.

README 文档

README

Banner of Laravel Steam API SDK

License Latest Version on Packagist Total Downloads Tests

Laravel bridge for fkrzski/php-steam-api-sdk. Ships a service provider, a Steam facade and a Steam::fake() test helper so you can talk to the Steam Web API the Laravel way.

  • Auto-discovered SteamConnector singleton, Octane-safe.
  • Rate-limit budget shared across processes through the Laravel cache store.
  • Fluent Steam facade with first-class request helpers.
  • One-liner test fakes via Saloon's MockClient.

Requirements

  • PHP 8.5+
  • Laravel 13+

Installation

composer require fkrzski/laravel-steam-api-sdk

The service provider and Steam facade are auto-discovered. Publish the config to override defaults:

php artisan vendor:publish --tag=steam-api-config

Set your Steam Web API key in .env:

STEAM_API_KEY=your-steam-web-api-key

Usage

use Fkrzski\LaravelSteamApiSdk\Facades\Steam;
use Fkrzski\SteamApiSdk\ValueObjects\SteamId;

$id = SteamId::fromSteamId64('76561198000000000');

$summaries    = Steam::playerSummaries([$id]);
$library      = Steam::ownedGames($id, appIdsFilter: [381210]);
$stats        = Steam::userStatsForGame($id, appId: 381210);
$achievements = Steam::playerAchievements($id, appId: 381210);
$resolvedId   = Steam::resolveVanityUrl('gabelogannewell');

DTOs, the SteamId value object and the exception hierarchy all come from the underlying SDK — see its README for the full surface.

Concurrent requests

Use pool() to fan out several requests at once:

use Fkrzski\LaravelSteamApiSdk\Facades\Steam;
use Fkrzski\SteamApiSdk\Http\Requests\GetOwnedGamesRequest;
use Fkrzski\SteamApiSdk\Http\Requests\GetPlayerSummariesRequest;
use Saloon\Http\Response;

Steam::pool(
    requests: [
        new GetOwnedGamesRequest($id, [381210]),
        new GetPlayerSummariesRequest([$id]),
    ],
    concurrency: 2,
    responseHandler: fn (Response $response) => /* ... */,
)->send()->wait();

Escape hatch

Need the raw connector or a custom request? Reach for it directly:

Steam::connector();          // the underlying SteamConnector
Steam::send($customRequest); // any Saloon Request

Testing

Steam::fake() attaches a Saloon MockClient to the singleton connector and returns it for assertions:

use Fkrzski\LaravelSteamApiSdk\Facades\Steam;
use Fkrzski\SteamApiSdk\Http\Requests\GetPlayerSummariesRequest;
use Saloon\Http\Faking\MockResponse;

$mock = Steam::fake([
    GetPlayerSummariesRequest::class => MockResponse::make([
        'response' => ['players' => [/* ... */]],
    ]),
]);

// ... exercise code that calls the Steam API ...

$mock->assertSent(GetPlayerSummariesRequest::class);

License

MIT. See LICENSE.md.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-11