PLoL is a PHP API that tries to simplify with the League of Legends API The main focus is to add versability and scalability. It implements a cache system and a rate limiter handler, custom output modes, custom error codes handler.
- guzzlehttp/guzzle to handle requests
- tedivm/stash to handle the cache system
- symfony/yaml in a Output mode class to output results in yaml
Using Composer
composer require "kolter/plol" dev-master
composer.json
"require":
{
"kolter/plol":"dev-master"
}
First of all, get your League of Legends API KEY. You will need this api key to instance resources. In the config/config.json folder there are some parameters you may want to change:
There are some default options that you may consider change:
- cache: true means resources will be cached, false won't.
- region: default region to the api. (check regions acronym)
This library use the PSR-4 implementation of namespaces. Basic implementation:
<?php
use Kolter\PLoL\Resources\Game;
include('path/to/vendor/autoload.php');
$game = new Game("{YOUR API KEY HERE}");
echo $game->get(1245678);
This is basic usage, you will get the result in json (by default). you can set some option in one specified instance.
$game = (new Game("{YOUR API KEY HERE}"))->setCache(false)
->setOutputMode(ObjectOutput());
$game->get(1245678)->games->fellowPlayers[0]->teamId;
Take a look at the ResourceRequest class API for more information.
Resources are what you can get in the League of Legends API. Bellow there are different resources and how to use them, with examples.
Every resource class extends from this. This is where the core is.
Get info of a specific champion
Get info of the current game.
Get info of the current game.
Get info of the current game.