supergrecko/twitch

Riot Games API Wrapper

1.0.0 2018-12-09 13:29 UTC

README

Current Version: v1.0.0

A simple PHP wrapper for the Riot Games API

This library is written to make requests to the Riot Games API simple. The library is still under development and might have some bugs.

All documentation can be found at twitch.supergrecko.com

Here's a simple list of some of Twitch's features.

  • Simple and easy to use
  • Abillity to run multiple instances
  • Access data using "dot notation"
  • PSR-16 SimpleCaching

Endpoints Supported

  • Champion Mastery V4
  • League V4
  • Match V4
  • Spectator V4
  • Summoner V4
  • Third Party Code V4
  • Tournament Stub V4
  • Champion V3
  • Lol Status V3

Todo List

  • Rate Limiting
  • Data Transfer Objects
  • Callbacks
  • Async Requests
  • Support Tournament API

Examples

Simple example creating a new instance

<?php
require __DIR__ . '/vendor/autoload.php';

use Twitch\Api\Context;
use Twitch\Api\Key;
use Twitch\Api\Calls\Summoner;
use Twitch\Constants\Region;
use Symfony\Component\Cache\Simple\FilesystemCache;

$twitch = new Context(FilesystemCache::class, [
    'keys' => [
        Key::STANDARD_KEY   => new Key('RGAPI-0000', Key::STANDARD_KEY),
        Key::TOURNAMENT_KEY => new Key('RGAPI-0000', Key::TOURNAMENT_KEY)
    ],
    'region' => Region::EUW
]);

$request = Summoner::via($twitch)->byName('mySummonerName');
?>

// Echo result data
echo $request['name'];