1. Go to this page and download the library: Download michaelgarrez/lol-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/ */
use Symfony\Component\Cache\Adapter\RedisAdapter;
$client = new \Predis\Client([
'scheme' => 'tcp',
'host' => '127.0.0.1',
'port' => 6379,
]);
$redisAdapter = new RedisAdapter($client);
$apiClient->setCacheProvider($redisAdapter);
// This will call the API and return to you an ApiResult object
$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');
// Let's cache this result for 60 seconds into Redis
$apiClient->cacheApiResult($result, 60);
// This will fetch the data from Redis and return to you an ApiResult object
$result = $apiClient->getSummonerApi()->getSummonerBySummonerName('MySummonerName');