PHP code example of timmsy / piltover-client

1. Go to this page and download the library: Download timmsy/piltover-client 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/ */

    

timmsy / piltover-client example snippets


use Timmsy\PiltoverClient\Facades\Piltover;

// 1. Get Account Info by Riot ID
$account = Piltover::accountByRiotId('TheCHEF', 'EUW');

// 2. Get Summoner Info using PUUID
$puuid = $account['puuid'] ?? null;
$summoner = $puuid ? Piltover::summonerByPuuid($puuid) : null;

// 3. Get Matches using PUUID
$matches = $puuid ? Piltover::matchesByPuuid($puuid, ['count' => 5]) : [];

// 4. Get Single Match Details
$match = !empty($matches) ? Piltover::matchById($matches[0]) : null;

use Timmsy\PiltoverClient\Http\RiotClient;

$client = new RiotClient('your_api_key', 'euw1');
$acct = $client->accountByRiotId('TheCHEF', 'EUW');
print_r($acct);

piltover()->matchById('EUW1_123456789');

return [
    'api_key'  => env('RIOT_API_KEY'),
    'platform' => env('RIOT_PLATFORM', 'euw1'),
    'regional' => env('RIOT_REGIONAL', null),
    'base_urls' => [
        'platform' => 'https://{platform}.api.riotgames.com',
        'regional' => 'https://{regional}.api.riotgames.com',
    ],
    'timeout' => 10,
];

'middleware' => ['web', 'auth'],
bash
php artisan vendor:publish --tag=piltover-config