1. Go to this page and download the library: Download lpphan/riot-api 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/ */
lpphan / riot-api example snippets
use Lpphan\RiotApi;
// Load up the API
$api = new RiotApi($apiKey);
// Load up the summoner api object.
$summoner = $api->summonerApi();
// Get the information about this user, this will return an Lpphan\Response object
$response = $summoner->getSummonerByNames($arrayOfSummonerName);
$info = $response->getBody();
print_r($info);
use Lpphan\RiotApi;
use Lpphan\Regions;
// Load up the API
$api = new RiotApi($apiKey);
$api->setRegion(Regions::BR);
//or
$summoner = $api->summonerApi();
$api->setRegion(Regions::BR);
$summoner->getSummonerByNames($array);
use Lpphan\RiotApi;
$api = new RiotApi($apiKey);
$summoner = $api->summonerApi();
//Cache this response for 5 minutes
$response = $summoner->getSummonerByNames(['summonerName'])->remember(5);
//or use this
$api->remember($response,5);
use Lpphan\RiotApi;
//set custom cache
$api = new RiotApi($apiKey,$cacheProvider);
//or use this
$api->setCache($cacheProvider);
use Lpphan\RiotApi;
$api = new RiotApi($apiKey);
$summoner = $api->summonerApi();
try{
$response = $summoner->getSummonerByNames(['summonerName']);
}catch (Lpphan\Exception\Http404Exception $e){
//throw when a 404 http error is found
}catch (Lpphan\Exception\Http429Exception $e){
//Rate limit exceeded
//Should retry after
$seconds = $e->retryAfter();
}catch (Lpphan\Exception\HttpException $e){
//throw for all http error
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.