zeggriim/riot-api-datadragon

Riot DataDragon API包装器

2.0.6 2024-06-23 16:20 UTC

README

介绍

欢迎来到PHP DataDragon库的仓库!这个库的目的是为所有需要的人创建一个易于使用的库。

此Symfony 6捆绑包提供了与Riot Games API(特别是《英雄联盟》的数据Dragon数据)的简单而有效的集成。 (其他API即将到来)它允许您轻松访问有关英雄、物品、技能等信息,直接从您的Symfony应用程序中获取。

安装

要安装此捆绑包,请使用Composer

composer require zeggriim/riot-api-data-dragon-bundle

添加捆绑包

// config/bundles.php
return [
    // Other Bundles
    Zeggriim\RiotApiDataDragon\RiotApiDataDragonBundle::class => ['all' => true],
];

配置

在所需环境的.env文件中添加

API_RIO_BASE_URI='https://ddragon.leagueoflegends.com'

示例

    namespace App\Controller;
    
    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\Routing\Annotation\Route;
    use Zeggriim\RiotApiDataDragon\Endpoint\DataDragon\VersionApiInterface;
    
    class HomeController
    {
        #[Route('/home', name: 'app_home')]
        public function index(VersionApiInterface $versionApi): Response
        {
            $versionApi->getVersions();
            // ['14.8.1','14.7.1','14.6.1','14.5.1','14.4.1'....]
        }
    }

端点列表