simivar / riot-php

基于依赖注入的围绕Riot Games API的包装器。

1.0.0 2020-11-20 02:28 UTC

README

围绕Riot Games API的PHP包装器。

特性

  • 🎉 符合PSR-18 & PSR-17 - 不再依赖特定的HTTP客户端!
  • 🎉 依赖注入优先 - 与所有现代框架易于使用!
  • 🎉 GitHub Actions进行质量保证 - 直接工作!
  • 🎉 单一职责 - 仅内部API通信!

入门指南

Riot PHP可通过Composer获取。它不自行实现HTTP客户端,并使用PSR-17和PSR-18抽象,因此您可以自由选择任何HTTP客户端。

composer require simivar/riot-php symfony/http-client nyholm/psr7

API覆盖范围

⚠️ 名称带有删除线的API已弃用并将被移除。

使用方法

<?php

require_once('vendor/autoload.php');

$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$connection = new \Riot\Connection(
    $httpClient,
    'PASTE-YOUR-API-KEY-HERE',
    $httpClient,
    $httpClient
);
$riotApi = new \Riot\API($connection);
$lolStatus = $riotApi->getVersion4()
    ->getLolStatus()
    ->getPlatformData(\Riot\Enum\RegionEnum::EUN1())
    ;

法律声明

Riot PHP未获得Riot Games的认可,也不反映Riot Games或任何官方参与制作或管理Riot Games财产的观点或意见。Riot Games及其所有相关财产均为Riot Games, Inc.的商标或注册商标。