2017 © Pedro Peláez
 

library lol-api

Yet Another LoL API SDK Wrapper

image

proveyourskillz/lol-api

Yet Another LoL API SDK Wrapper

  • Friday, March 9, 2018
  • by AnToni00
  • Repository
  • 3 Watchers
  • 2 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

League of Legends PHP API wrapper

Dead simple wrapper of Riot Games API (LoL), (*1)

Requirements

  • PHP 7.1
  • works better with ext-curl installed

Installation

composer require proveyourskillz/lol-api, (*2)

Creating API instance

$api = new PYS\LolApi\Api(API_KEY);

Laravel/Lumen service provider and Facade

Laravel/Lumen 5.5

ServiceProvider and Facade are registered automatically through package discovery, (*3)

Laravel 5.4

In config/app.php add PYS\LolApi\Laravel\ServiceProvider as provider, (*4)

Lumen 5.4

Register ServiceProvider according documentation, (*5)

Optionally you can add facade to aliases 'LolApi' => PYS\LolApi\Laravel\Facade::class, (*6)

After installation, you can use API through facade or inject as dependency, (*7)

Usage

You can find examples of usage in examples dir, (*8)

Region

You can pass region to request as 2-3 characters code but better use Region class constants, (*9)

use PYS\LolApi\ApiRequest\Region;

$summoner = $api->summoner(Region::EUW, $summonerId);

Summoner

There are several ways to get Summoner: by account id, summoner id or by name, (*10)

// You can get summoner in several ways by passing type in third argument
// Default version: summoner, you can ommit it
$summonerById = $api->summoner($region, $summonerId);
$summonerByAccount = $api->summoner($region, $accountId, 'account');
$summonerByName = $api->summoner($region, $name, 'name');

For more information see Summoner API reference, (*11)

Match List

Recent, (*12)

$matches = $api->matchList($region, $accountId);

Recent via Summoner, (*13)

$matches = $api->summoner($region, $summonerId)->recentMatches();

Using query (e.g. one last match), (*14)

$matches = $api->matchList(
    $region,
    $accountId,
    [
        'beginIndex' => 0,
        'endIndex' => 1,
    ]
);

Match

Match by Id, (*15)

$match = $api->match($region, $matchId);

Match within Tournament, (*16)

$match = $api->match($region, $matchId, $tournamentId);

For more information see Match API reference, (*17)

Leagues

Leagues and Positions of summoner by Summoner Id, (*18)

$leaguesPositions = $api->leaguePosition($region, $summonerId);

Leagues and Positions of summoner via Summoner object, (*19)

$leaguesPositions = $api
    ->summoner($region, $summonerId)
    ->leaguesPositions();

Leagues by Summoner Id, (*20)

$leagues = $api->league($region, $summonerId);

Reusable requests and queries

Examples from above (e.g., match list request with query) are shows usage of syntax sugar methods and can be rewritten as, (*21)

use PYS\LolApi\ApiRequest\MatchListRequest;
use PYS\LolApi\ApiRequest\Query\MatchListQuery;

$api = new PYS\LolApi\Api($API_KEY);

$query = new MatchListQuery;
$request = new MatchListRequest($region, $accountId);
$request->setQuery($query->lastMatches(1));

$matchList = $api->make($request);

Query objects have fluent setters for easy setup some properties like dates etc., (*22)

// Setup query object to get last 5 matches in 24 hours
$query = new MatchListQuery;
$query
    ->fromDate(new DateTime('-24 hours'))
    ->lastMatches(5);

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

Alpha version, (*23)

Credits

License

MIT, (*24)

The Versions

09/03 2018

dev-master

9999999-dev

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api

02/02 2018

dev-analysis-86oeoM

dev-analysis-86oeoM

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api

13/09 2017

0.1.3

0.1.3.0

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api

11/09 2017

0.1.2

0.1.2.0

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api

10/09 2017

0.1.1

0.1.1.0

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api

10/09 2017

0.1.0

0.1.0.0

Yet Another LoL API SDK Wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Anton Orlov
by Pavel Dudko

api wrapper lol riot-games lol-api