1. Go to this page and download the library: Download callisto/riot-api-wrapper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
callisto / riot-api-wrapper example snippets
$raw = new \Callisto\RiotApiWrapper\RiotApiWrapper('YOUR_API_KEY');
// Get recent LoL matches exemple
r\RiotApiWrapper('YOUR_API_KEY'); // Init RiotApiWrapper
$raw->Cache(); // (Optional) Enable cache.
// (Optional) Request options
$options = [
'startTime' => strtotime('01/01/2023'), // (Optional) timestamp (seconds). Before this date, matches won't be 20, // (Optional) max results count
];
try {
$matchesIds = $raw->LOL()->Matches('EUROPE')->ids('PUUID',$options); // Return matches ids list
foreach ($matchesIds as $matchId){
$matches[] = $raw->LOL()->Matches('EUROPE')->match($matchId); // Return match datas from match id
}
print_r($matches);
}Catch(Exception $exception){
exit($exception->getMessage());
}Catch(\Callisto\RiotApiWrapper\Exceptions\RequestExceptions $exception){
exit($exception->getMessage());
}
// Search summoner
$name = 'example'; // Summoner name to search
$raw = new \Callisto\RiotApiWrapper\RiotApiWrapper('YOUR_API_KEY'); // Init RiotApiWrapper
$raw->Cache(); // (Optional) Enable cache.
$searchPlatform = ['BR1','EUN1','EUW1','JP1','KR','LA1','LA2']; // Select platforms you want to search on
try {
foreach ($searchPlatform as $platform){
$results[$platform] = $raw->LOL()->Summoner($platform)->byName($name); // Save result even if empty
}
}catch (\Callisto\RiotApiWrapper\Exceptions\RequestExceptions $exception){
exit($exception->getMessage());
} catch (Exception $e) {
exit($e->getMessage());
}
print_r($results);
// Get summoner and last match
apper\RiotApiWrapper('YOUR_API_KEY'); //Init RiotApiWrapper
$raw->Cache(); // (Optional) Enable cache.
try {
$summoner = $raw->TFT()->Summoner('EUW1')->byName('NAME'); // Get {NAME} summoner data
$options = [
'count' => 1, // (Optional) max results count
];
$lastMatchId = $raw->TFT()->Matches('EUROPE')->ids($summoner['puuid'],$options)[0]; // Get last match id
$lastMatch = $raw->TFT()->Matches('EUROPE')->match($lastMatchId); // Get $lastMatchId match data
print_r($lastMatch);
} catch (Exception $exception) {
exit($exception->getMessage());
} catch (\Callisto\RiotApiWrapper\Exceptions\RequestExceptions $exception) {
exit($exception->getMessage());
}