PHPackages                             m1so/leaguewrap - 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. m1so/leaguewrap

ActiveLibrary[API Development](/categories/api)

m1so/leaguewrap
===============

Riot Games API client

v1.0.1(8y ago)73344[1 issues](https://github.com/m1so/LeagueWrap/issues)[1 PRs](https://github.com/m1so/LeagueWrap/pulls)MITPHPPHP ^5.6 || ^7.0

Since Jul 24Pushed 8y ago3 watchersCompare

[ Source](https://github.com/m1so/LeagueWrap)[ Packagist](https://packagist.org/packages/m1so/leaguewrap)[ RSS](/packages/m1so-leaguewrap/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (12)Versions (3)Used By (0)

LeagueWrap
==========

[](#leaguewrap)

Simple yet powerful PHP wrapper for [Riot Games API](https://developer.riotgames.com/) (formerly [LeaguePHP/LeagueWrap](https://github.com/LeaguePHP/LeagueWrap) and [paquettg/leaguewrap](https://github.com/paquettg/leaguewrap)).

The library has been fully rewritten to support v3 of the League of Legends API and adapted to use modern PHP standards such as PSR-4, PSR-6 and PSR-7. Guzzle has been removed in favor of [PHP-HTTP](http://docs.php-http.org/en/latest/), while the caching and rate-limiting backends now fully support PSR-6 through [PHP Cache](http://www.php-cache.com/en/latest/).

Note that the HTTP client is pluggable and must be chosen when installing the library. For example using Guzzle along with LeagueWrap would look like:

```
composer require \
    php-http/guzzle6-adapter \
    php-http/message \
    guzzlehttp/psr7 \
    m1so/leaguewrap
```

See the [library users](http://docs.php-http.org/en/latest/httplug/users.html#details) section for more information.

- [Features](#features)
- [Example](#example)
- [Rate limiting and Caching](#rate-limiting-and-caching)
- [Extras](#extras)
    - [Additional headers](#additional-headers)
- [Gotchas](#gotchas)
    - [Batch request calls / caching](#batch-request-calls-caching)
- [Todo](#todo)

Features
--------

[](#features)

- Simple API design
    - leverages PHP's magic methods and provides phpdoc annotations
    - implements `ArrayAccess` and "dot notation" to quickly grab data
- Rate limiting supports app and method limits
- PSR-6 compatible caching with multiple backend adapters and framework integrations
- Batch calls - every method can accept an array of identifiers to generate multiple asynchronous requests

Example
-------

[](#example)

```
use LeagueWrap\Client as RiotApi;

$api = new RiotApi('RGAPI-xxx', 'euw');

// The following calls produce the same results
$api->match()->getById($id);
$api->match()->byId($id);

// Support for batch calls (requires multiple async requests)
$api->match()->getById([$gameId, $anotherGameId]); // using array as an argument
$api->match()->byIds([$gameId, $anotherGameId]); // dedicated method on the Match API Class

// Simple data access
$myGame = $api->match()->byId($id);
$myGame['gameId'] === $id;
$myGame['teams.0.teamId'] === 100; // "dot" notation support for nested elements
```

Rate limiting
-------------

[](#rate-limiting)

Any PSR-6 compatible cache pool can be used for rate limiting backend. If no pool is supplied, the filesystem is used. For list of available pools see [php-cache docs](http://www.php-cache.com/en/latest/#cache-pool-implementations).

```
// Redis backend with Predis client
// @see https://github.com/php-cache/predis-adapter
$client = new \Predis\Client('tcp:/127.0.0.1:6379');
$pool = new \Cache\Adapter\Predis\PredisCachePool($client);

$api->setAppLimits([
    '10' => 100, // 100 requests per 10 seconds
], $pool);

// When using Laravel
$store = app(\Illuminate\Cache\Repository::class)->getStore();
$pool = new \Cache\Adapter\Illuminate\IlluminateCachePool($store);

$api->setLimits([
    '10' => 100, // 100 requests per 10 seconds
], $pool);

/*
 * Caching is very similar, infact the same pool can be shared with the rate-limiter.
 */
$api->addCache($pool);
$api->removeCache();
```

Extras
------

[](#extras)

### Additional headers

[](#additional-headers)

The underlying PSR response contains additional headers such as:

- `X-Region` - region string, can be used with `Region::create($value)`
- `X-Endpoint` - endpoint name, can be used with `BaseApi::$endpointDefinitions[$endpointName]`

Gotchas
-------

[](#gotchas)

### Batch request calls / caching

[](#batch-request-calls--caching)

Consider the following example:

```
$api->addCache($cachePool)->match()->byIds([$id1, $id2, ..., $idN, $id1]);
```

it is possible that `N+1` requests will be made instead of `N` (where the second call with `$id1` would be cached) because Guzzle can start multiple requests "concurrently", therefore the second call would be fired before the first response could be received and cached.

This scenario is not that significant in most cases as requesting multiple same resources should be avoided in the application logic.

Todo
----

[](#todo)

- Finish writing annotations for phpdoc
- Custom cache TTL for individual endpoints
- Sync rate limits and usage from responses
- Clean up batch responses sorting
- Dto support?
- Should the filesystem cache be used by default or use void?

---

PHP LeagueWrap API isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~87 days

Total

2

Last Release

3127d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84909c2cbe53b543c62a1ae5b54ae06e8ec9eca39a2d4017e7b853be75e90d4c?d=identicon)[m1so](/maintainers/m1so)

---

Top Contributors

[![m1so](https://avatars.githubusercontent.com/u/983741?v=4)](https://github.com/m1so "m1so (6 commits)")

---

Tags

phpriot-games-apiapileagueLoLgamesRiotlegendsleaguewraprito

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/m1so-leaguewrap/health.svg)

```
[![Health](https://phpackages.com/badges/m1so-leaguewrap/health.svg)](https://phpackages.com/packages/m1so-leaguewrap)
```

###  Alternatives

[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[m4tthumphrey/php-gitlab-api

GitLab API v4 client for PHP

9485.4M64](/packages/m4tthumphrey-php-gitlab-api)[dhope0000/lxd

PHP-based API wrapper for LXD REST API.

136.2k](/packages/dhope0000-lxd)[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[darthsoup/php-whmcs-api

WHMCS API client for PHP

2317.3k4](/packages/darthsoup-php-whmcs-api)

PHPackages © 2026

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