timmsy/piltover-client
Composer 安装命令:
composer require timmsy/piltover-client
包简介
Riot Games API wrapper with Laravel integration.
README 文档
README
A PHP / Laravel-ready API wrapper for the Riot Games Developer API, built by Timmsy.
🚀 Overview
PiltoverClient is a lightweight, framework-agnostic API client for the Riot Games Developer API. It integrates seamlessly with Laravel but can also be used in any PHP project.
The client implements the modern Riot API flow:
- 🔹 Resolve players via account-v1 using their Riot ID (
gameName+tagLine) - 🔹 Use PUUID to fetch summoner profiles, matches, and more
- 🔹 Automatically maps platform → regional clusters (EUW → EUROPE, NA → AMERICAS, etc.)
- 🔹 Provides Laravel Facade + helper for elegant usage
- 🔹 Fully PSR-compliant, Guzzle-powered
⚙️ Installation
composer require timmsy/piltover-client
🧩 Laravel Setup
If you're using Laravel, PiltoverClient auto-discovers its service provider and facade.
Publish Configuration
php artisan vendor:publish --tag=piltover-config
Add to .env
RIOT_API_KEY=your_api_key_here
RIOT_PLATFORM=euw1
# Optional (will be derived automatically if omitted)
# RIOT_REGIONAL=europe
💻 Usage Examples
🔸 Laravel Facade
use Timmsy\PiltoverClient\Facades\Piltover; // 1. Get Account Info by Riot ID $account = Piltover::accountByRiotId('TheCHEF', 'EUW'); // 2. Get Summoner Info using PUUID $puuid = $account['puuid'] ?? null; $summoner = $puuid ? Piltover::summonerByPuuid($puuid) : null; // 3. Get Matches using PUUID $matches = $puuid ? Piltover::matchesByPuuid($puuid, ['count' => 5]) : []; // 4. Get Single Match Details $match = !empty($matches) ? Piltover::matchById($matches[0]) : null;
🔸 Standalone PHP
use Timmsy\PiltoverClient\Http\RiotClient; $client = new RiotClient('your_api_key', 'euw1'); $acct = $client->accountByRiotId('TheCHEF', 'EUW'); print_r($acct);
🧭 Supported Endpoints
| Endpoint | Scope | Method | Description |
|---|---|---|---|
/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine} |
Regional | accountByRiotId() |
Get player account and PUUID |
/lol/summoner/v4/summoners/by-puuid/{puuid} |
Platform | summonerByPuuid() |
Get Summoner info |
/lol/match/v5/matches/by-puuid/{puuid}/ids |
Regional | matchesByPuuid() |
Get recent match IDs |
/lol/match/v5/matches/{matchId} |
Regional | matchById() |
Get full match details |
🧰 Helpers
piltover()->matchById('EUW1_123456789');
🧪 Testing
composer test
Includes PHPUnit + Orchestra Testbench for Laravel context tests.
⚙️ Config File (config/piltover.php)
return [ 'api_key' => env('RIOT_API_KEY'), 'platform' => env('RIOT_PLATFORM', 'euw1'), 'regional' => env('RIOT_REGIONAL', null), 'base_urls' => [ 'platform' => 'https://{platform}.api.riotgames.com', 'regional' => 'https://{regional}.api.riotgames.com', ], 'timeout' => 10, ];
📚 API Documentation
PiltoverClient includes a built-in OpenAPI 3.1 specification and ReDoc-powered documentation viewer. This allows developers to explore all supported Riot Games API endpoints visually.
🔧 Laravel Integration
Once installed in a Laravel app, the docs are automatically available at:
- ReDoc UI:
/piltover/docs - Raw Spec:
/piltover/docs/openapi.json
Configure in config/piltover.php or .env:
PILTOVER_DOCS_ENABLED=true PILTOVER_DOCS_PATH=piltover/docs PILTOVER_SPEC_PATH=piltover/docs/openapi.json
Optional authentication:
'middleware' => ['web', 'auth'],
🧩 Standalone Mode
PiltoverClient also ships with a local static docs server:
composer docs:serve
Visit: http://127.0.0.1:8765/docs/
This uses the same OpenAPI spec from resources/openapi/.
🧠 OpenAPI Overview
The included spec documents:
| Endpoint | Scope | Method | Description |
|---|---|---|---|
/riot/account/v1/accounts/by-riot-id/{gameName}/{tagLine} |
Regional | GET | Retrieve account + PUUID by Riot ID |
/lol/summoner/v4/summoners/by-puuid/{puuid} |
Platform | GET | Fetch Summoner profile by PUUID |
/lol/match/v5/matches/by-puuid/{puuid}/ids |
Regional | GET | List recent matches by PUUID |
/lol/match/v5/matches/{matchId} |
Regional | GET | Retrieve match details |
🧾 Notes
- Works both in Laravel and standalone PHP contexts.
- Fully PSR-4 compliant — no runtime dependencies beyond
illuminate/supportandguzzle. - You can extend the
resources/openapi/openapi.yamlspec as you add endpoints.
📦 Future Roadmap
- Add all Riot endpoints (League, Spectator, Champion)
- Rate-limit & retry middleware
- Data Dragon (champions, icons, maps)
- Cached responses
- CLI utilities for dev testing
📜 License
MIT License © 2025 James Timms Created and maintained by @Timmsy1998
timmsy/piltover-client 适用场景与选型建议
timmsy/piltover-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「client」 「composer」 「docs」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timmsy/piltover-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timmsy/piltover-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timmsy/piltover-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
Alfabank REST API integration
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-22