A rock-solid php library for the league of legends API.
To get quickly started with this library, include the library first. Then, generate a new LeagueOfLegendsAPI object.
After that we fetch "Hide on bush"'s profile in KR and print the result.
<?php
include_once("/path/to/library.php");
#include the library
$api = new LeagueOfLegendsAPI("RGAPI-KEY","kr",true,"/var/tmp/api-cache");
# be careful: the library throws an error if the region doesn't exist
$puuid = $api->getAccountByRiotId("Hide on bush","KR1")["puuid"]; # $api->getAccountByRiotId("Hide on bush#KR1")["puuid"] would also work
$summoner =$api->getSummonerByPUUID($puuid);
print_r($summoner);
# {
# "id": ...,
# "accountId": ...,
# "puuid": ...,
# "name": "Hide on bush",
# ...
#}
?>
To use this library you need to generate a new object from the LeagueOfLegendsAPI class.
The constructor takes several parameters
Parameter | Type | Example | Required |
---|---|---|---|
Api Key | String | "RGAPI-..." | YES |
Region | String | "euw1", "euw" | YES |
Cache | Boolean | true | NO (default: true) |
CacheDirectory | String (Path) | "/var/tmp/api-cache" | NO (default: /tmp) |
The library throws error if the usage is wrong. If the Riot Games API throws errors to the library the library returns the Integer as a return value.
For example:
$summoner = $api->getSummonerByName("THIS SUMMONER DOES NOT EXIST");
# returns 404
# possible catches are
if(gettype($summoner) === "integer") {
echo "the requested summoner does not exist";
}
Please read the docs for a detailed description.
This library should work, but of course there is no warranty for using it.
The 'MalPHPhite' 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 Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.