PHPackages                             michaelgarrez/lol-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. michaelgarrez/lol-api

ActiveLibrary[API Development](/categories/api)

michaelgarrez/lol-api
=====================

Wrapper for League of Legends API

v3.0.0(6y ago)182.6k9[4 PRs](https://github.com/Babacooll/lol-api/pulls)MITPHP

Since Aug 21Pushed 3y ago4 watchersCompare

[ Source](https://github.com/Babacooll/lol-api)[ Packagist](https://packagist.org/packages/michaelgarrez/lol-api)[ RSS](/packages/michaelgarrez-lol-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (28)Used By (0)

League of Legends API wrapper in PHP
------------------------------------

[](#league-of-legends-api-wrapper-in-php)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/31334a7eb23c8497c51b63a3ea7a0a6800d2ec38572c5203275eecdb4ced2dd0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f42616261636f6f6c6c2f6c6f6c2d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Babacooll/lol-api/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c3badee47a04d40cb2e523769a624adb9ff04c9819d29b0dbc5d71003f3c6d26/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f42616261636f6f6c6c2f6c6f6c2d6170692f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Babacooll/lol-api/?branch=master)[![Build Status](https://camo.githubusercontent.com/9d24a85ea1c4ac229eb988bf8602af36a709e13721a817480adf9d16a1f04927/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f42616261636f6f6c6c2f6c6f6c2d6170692f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Babacooll/lol-api/build-status/master)[![Build Status](https://camo.githubusercontent.com/e72ff5c84600c43f88dca5f5eb6a5b7ea20da5da4da2c844d9bb17df176b403c/68747470733a2f2f7472617669732d63692e6f72672f42616261636f6f6c6c2f6c6f6c2d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Babacooll/lol-api)[![SensioLabsInsight](https://camo.githubusercontent.com/ab18dc6c185552fb5177b4747cfcff7f56aaa77d40e476f09049d24f76aaf535/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35303137303933312d383834382d343434302d396536632d3337643933373839383662392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/50170931-8848-4440-9e6c-37d9378986b9)[![Latest Stable Version](https://camo.githubusercontent.com/d5ac98fee8cf718f8e953f28e9d03f457a644a7538f64adaaca4fc3a927c960c/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c67617272657a2f6c6f6c2d6170692f762f737461626c65)](https://packagist.org/packages/michaelgarrez/lol-api)[![Total Downloads](https://camo.githubusercontent.com/335995c469af8902144926a7b21492361acc66ffb04f65fec9dc53437233935a/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c67617272657a2f6c6f6c2d6170692f646f776e6c6f616473)](https://packagist.org/packages/michaelgarrez/lol-api)[![Latest Unstable Version](https://camo.githubusercontent.com/c00368a07adfd24d465af0a2530ade0ae10182accaecc781a3fc8377298cc391/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c67617272657a2f6c6f6c2d6170692f762f756e737461626c65)](https://packagist.org/packages/michaelgarrez/lol-api)[![License](https://camo.githubusercontent.com/fb32f17edb44073ca36c9e711b6a8b13a1ae915398792049171ed1e323517ee1/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c67617272657a2f6c6f6c2d6170692f6c6963656e7365)](https://packagist.org/packages/michaelgarrez/lol-api)[![Dependency Status](https://camo.githubusercontent.com/229c9bfeb938f7224f32a113e3851a80928e054de7b5132bbf2dd44b31eb5e54/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535653561613161386330663632303031633030303335362f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/55e5aa1a8c0f62001c000356)

### Introduction

[](#introduction)

Simple PHP wrapper for [League of legends API](https://developer.riotgames.com/api/methods).

This library implements two custom exceptions to catch your API rate limits (ServiceRateLimitException &amp;&amp; UserRateLimitException).

It also implements [Doctrine cache](https://github.com/doctrine/cache) to cache the API results into your favorite cache driver.

### Migration from 0.\* to 1.\*

[](#migration-from-0-to-1)

Three main features breaking BC caused a bump to the 1.\* version:

- Cache implementation
- AbstractRateLimitException
- Return of an ApiResult object instead of an array

Only the third one can actually break BC. You should now use the **getResult()** method on the ApiResult object returned.

### How to use

[](#how-to-use)

#### Basic use

[](#basic-use)

You first have to select the API you want to fetch from and then the specific method. Each call will return an **ApiResult** object containing the URL called, the Guzzle Response object and an array containing the API result.

To get the result you can call the method **getResult()** on the ApiResult object.

```
$apiClient = new \LoLApi\ApiClient(\LoLApi\ApiClient::REGION_EUW, 'my-key');

$apiClient->getMatchApi()->getMatchListBySummonerId(2);
$apiClient->getMatchApi()->getMatchByMatchId(2, true);
$apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');
$apiClient->getSummonerApi()->getSummonerBySummonerId(2);
$apiClient->getMasteriesApi()->getMasteriesBySummonerId(2);
$apiClient->getRunesApi()->getRunesBySummonerId(2);
$apiClient->getSummonerApi()->getSummonerNameBySummonerId(2);
$apiClient->getChampionApi()->getChampionById(20);
$apiClient->getFeaturedGamesApi()->getFeaturedGames();
$apiClient->getStatsApi()->getRankedStatsBySummonerId(2);
$apiClient->getGameApi()->getRecentGamesBySummonerId(2);
$apiClient->getSpectatorApi()->getCurrentGameByPlatformIdAndSummonerId('EUW1', 2);
```

#### Use cache

[](#use-cache)

By default Symfony NullAdapter cache is used. You can specify another Cache Adapter (implementing PSR6 Adapters) to the ApiClient.

Example with Predis :

```
use Symfony\Component\Cache\Adapter\RedisAdapter;

$client = new \Predis\Client([
    'scheme' => 'tcp',
    'host'   => '127.0.0.1',
    'port'   => 6379,
]);

$redisAdapter = new RedisAdapter($client);

$apiClient->setCacheProvider($redisAdapter);

// This will call the API and return to you an ApiResult object
$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');

// Let's cache this result for 60 seconds into Redis
$apiClient->cacheApiResult($result, 60);

// This will fetch the data from Redis and return to you an ApiResult object
$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');
```

The default ttl value **cacheApiResult()** method is 60 seconds.

#### Rate limit

[](#rate-limit)

When you reach the rate limit (User or Service) the library will throw you an implementation of the AbstractRateLimitException. You can get the type of rate limit and the time to wait before a new call (Riot is very strict on the rate limit respect).

Example with a sleep :

```
$apiClient = new \LoLApi\ApiClient(\LoLApi\ApiClient::REGION_EUW, 'my-key');

for ($i = 0; $i < 100; $i++) {
    try {
        $apiClient->getMatchApi()->getMatchListByAccountId(2);
    } catch (AbstractRateLimitException $e) {
        sleep($e->getRetryAfter());
    }
}
```

### API implemented

[](#api-implemented)

APIVersion[Summoner API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/081c9e97af64a8ccfb8971209c312f2fd735ead4ff02b1adc90ecc48e7aa9fc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/081c9e97af64a8ccfb8971209c312f2fd735ead4ff02b1adc90ecc48e7aa9fc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342d6c61746573742d677265656e2e737667)[Match API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/b3f70541bd368381e171887c61be0571d65912e9fffba49e08cd261f0d231056/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6d697373696e675f6d6574686f64732d6f72616e67652e737667)](https://camo.githubusercontent.com/b3f70541bd368381e171887c61be0571d65912e9fffba49e08cd261f0d231056/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6d697373696e675f6d6574686f64732d6f72616e67652e737667)[Champion API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[Spetactor API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[Static Data API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[League API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/081c9e97af64a8ccfb8971209c312f2fd735ead4ff02b1adc90ecc48e7aa9fc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/081c9e97af64a8ccfb8971209c312f2fd735ead4ff02b1adc90ecc48e7aa9fc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76342d6c61746573742d677265656e2e737667)[Status API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[Champion Mastery API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[Masteries API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)[Runes API](https://developer.riotgames.com/api-methods/)[![v3](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)](https://camo.githubusercontent.com/cad43c8310543af00e4ef863c2774799258f9b891300b23e441c0e560257acf3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76332d6c61746573742d677265656e2e737667)### Contributing

[](#contributing)

Please create issues if you have any problem with this library integration.

If you want to contribute, create a PR, you must respect PSR-2 and your code must be tested.

Thank you !

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~81 days

Recently: every ~374 days

Total

22

Last Release

2217d ago

Major Versions

v0.0.7 → v1.0.02015-08-27

v1.1.1 → v2.0.02017-07-25

v2.1.1 → v3.0.02020-04-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/00304841bf1d74e7dbb4d117140c3b821dba98804f78fce1dde4c990cafcccba?d=identicon)[Babacooll](/maintainers/Babacooll)

---

Top Contributors

[![Babacooll](https://avatars.githubusercontent.com/u/6329406?v=4)](https://github.com/Babacooll "Babacooll (50 commits)")[![tristanbes](https://avatars.githubusercontent.com/u/346010?v=4)](https://github.com/tristanbes "tristanbes (43 commits)")[![miukoba](https://avatars.githubusercontent.com/u/345965?v=4)](https://github.com/miukoba "miukoba (1 commits)")[![strebl](https://avatars.githubusercontent.com/u/6151204?v=4)](https://github.com/strebl "strebl (1 commits)")

---

Tags

apileague-of-legendsriot-gamesapilibraryleague of legendsLoLlol api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/michaelgarrez-lol-api/health.svg)

```
[![Health](https://phpackages.com/badges/michaelgarrez-lol-api/health.svg)](https://phpackages.com/packages/michaelgarrez-lol-api)
```

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
