kolter/plol

PHP interface wrapper to the League of Legends API

v1.0.0 2016-03-26 17:53 UTC

This package is not auto-updated.

Last update: 2024-04-19 16:06:36 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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.

Libraries used

How to install

Using Composer

composer require "kolter/plol" dev-master

composer.json

"require":
{
"kolter/plol":"dev-master"
}

Configuration

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)

Basic Api Usage

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.

Structure

Resources are what you can get in the League of Legends API. Bellow there are different resources and how to use them, with examples.

ResourceHandler

Every resource class extends from this. This is where the core is.

Champion

Get info of a specific champion

Featured Games

Get info of the current game.

Game

Get info of the current game.

League

Get info of the current game.