callisto / riot-api-wrapper
RiotApiWrapper (RAW)
Requires
- php: >=8.0.2
- symfony/framework-bundle: ^6.2
- symfony/http-client: ^6.2
README
RAW (RiotApiWrapper) is a PHP project designed to provide a wrapper for the Riot Games API, allowing developers to easily access the data and services offered by the API. With this wrapper, users can access the API through simple and intuitive PHP code, without needing to worry about the underlying technical details of the API.
Our goal is to make the Riot Games API accessible to as many people as possible, regardless of their technical background or level of expertise. By simplifying the interface and providing clear documentation, RAW enables a wider range of developers to take advantage of the wealth of data and services available through the Riot Games API.
Using Composer to manage dependencies, RAW is designed to be easy to install and integrate into any PHP project. Whether you're building a new application from scratch or adding new features to an existing project, RAW will make it easy to incorporate the Riot Games API into your code.
So if you're looking for a simple and reliable way to work with the Riot Games API, look no further than RAW. With clear documentation, intuitive code, and support for Composer, RAW is the perfect choice for anyone looking to get the most out of the Riot Games API.
Riot API | LoL API | TFT API | LORT API | Valorant API | Datadragon |
---|---|---|---|---|---|
✅ Available | ✅ Available | ✅ Available | 🚧 Work in progress | 🚧 Work in progress | 🚧 Work in progress |
Vote for next update priority (3.0.0) : https://strawpoll.com/polls/X3nk4qODEgE
Vote history :
- Vote result for version 2.0.0 (completed on 2023/04/12) : https://ibb.co/XZ6FsD2
Deployment
To install this project run
composer require callisto/riot-api-wrapper
RAW requires Symfony 6.2 or later and php 8.0 or later
Usage
$raw = new \Callisto\RiotApiWrapper\RiotApiWrapper('YOUR_API_KEY');
To get your api key, create an account on Riot's developer portal. Then, go to the dashboard and click on the button to generate a development key. To get a permanent key, register your application on the Riot Games developer site and wait for approval. Once approved, you can access Riot's API with your permanent API key.
https://developer.riotgames.com/
$summoner = $raw->LOL('EUW1')->Summoner()->byName('NAME');
References
You can see the original Riot api documentation here : https://developer.riotgames.com/apis
Platforms and regions list
Platforms list
['BR1','EUN1','EUW1','JP1','KR','LA1','LA2','NA1','OC1','TR1','RU','PH2','SG2','TH2','TW2','VN2']
Regions list
['AMERICAS','ASIA','EUROPE','SEA']
Wrapper References
Riot
// Riot/Account - Riot()->Account(string $region)->byPuuid(string $puuid) - Riot()->Account(string $region)->byGame(string $game, string $puuid)
LOL
// LOL/ChampionMastery - LOL()->ChampionMastery(string $platform)->bySummoner(string $encryptedSummonerId) - LOL()->ChampionMastery(string $platform)->byChampion(string $encryptedSummonerId, string $championId) - LOL()->ChampionMastery(string $platform)->top(string $encryptedSummonerId) - LOL()->ChampionMastery(string $platform)->scores(string $encryptedSummonerId)
// LOL/ChampionMastery - LOL()->Champion(string $platform)->rotations()
// LOL/Clash - LOL()->Clash(string $platform)->byPuuid(string $puuid) - LOL()->Clash(string $platform)->bySummoner(string $summonerId) - LOL()->Clash(string $platform)->team(string $teamId) - LOL()->Clash(string $platform)->tournaments() - LOL()->Clash(string $platform)->tournamentsByTeam(string $teamId) - LOL()->Clash(string $platform)->tournamentsById(string $tournamentId)
// LOL/LeagueExp - LOL()->LeagueExp(string $platform)->exp(string $queue, string $tier, string $division)
// LOL/League - LOL()->League(string $platform)->byQueue(string $queue) - LOL()->League(string $platform)->bySummonerId(string $summonerId) - LOL()->League(string $platform)->byQueueTierDivision(string $queue, string $tier, string $division) - LOL()->League(string $platform)->grandMasterLeagues(string $queue) - LOL()->League(string $platform)->leagueId(string $leagueId) - LOL()->League(string $platform)->masterLeagues(string $queue)
// LOL/Challenges - LOL()->Challenges(string $platform)->challenges() - LOL()->Challenges(string $platform)->percentiles() - LOL()->Challenges(string $platform)->challengeIdConfig(string $challengeId) - LOL()->Challenges(string $platform)->leaderboardByLevel(string $challengeId, string $level) - LOL()->Challenges(string $platform)->percentilesByChallengeId(string $challengeId) - LOL()->Challenges(string $platform)->playerData(string $puuid)
// LOL/Status - LOL()->Status(string $platform)->status()
// LOL/Matches - LOL()->Status(string $region)->ids(string $puuid, array $options = []) - LOL()->Status(string $region)->match(string $matchId) - LOL()->Status(string $region)->timeline(string $matchId)
// LOL/Spectator - LOL()->Spectator(string $platform)->activeGames(string $summonerId) - LOL()->Spectator(string $platform)->featuredGames()
// LOL/Summoner - LOL()->Summoner(string $platform)->byAccount(string $accountId) - LOL()->Summoner(string $platform)->byName(string $summonerName) - LOL()->Summoner(string $platform)->byPuuid(string $puuid) - LOL()->Summoner(string $platform)->bySummonerId(string $summonerId)
TFT (⭐ NEW)
// TFT/League - TFT()->League(string $platform)->challenger() - TFT()->League(string $platform)->bySummonerId(string $summonerId) - TFT()->League(string $platform)->byTierAndDivision(string $tier, string $division, array $options = []) - TFT()->League(string $platform)->grandmaster() - TFT()->League(string $platform)->byLeagueId(string $leagueId) - TFT()->League(string $platform)->master() - TFT()->League(string $platform)->topByQueue(string $queue)
// TFT/Matches - TFT()->Matches(string $region)->ids(string $puuid, array $options = []) - TFT()->Matches(string $region)->match(string $matchId)
// TFT/Status - TFT()->Status(string $platform)->platformData()
// TFT/Summoner - TFT()->Summoner(string $platform)->byAccountId(string $accountId) - TFT()->Summoner(string $platform)->byName(string $name) - TFT()->Summoner(string $platform)->byPuuid(string $puuid) - TFT()->Summoner(string $platform)->bySummonerId(string $summonerId)
LORT
🚧 Work in Progress
Valorant
🚧 Work in Progress
Exemples
LOL
// Get recent LoL matches exemple require __DIR__ . '/../../vendor/autoload.php'; $raw = new \Callisto\RiotApiWrapper\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 included in result. 'endTime' => strtotime('now'), // (Optional) timestamp (seconds). After this date, matches won't be included in result. 'queue' => 400, // (Optional) queue id. 'type' => 'normal', // (Optional) match type 'start' => 0, // (Optional) Start index 'count' => 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);
TFT
// Get summoner and last match require __DIR__ . '/../../vendor/autoload.php'; $raw = new \Callisto\RiotApiWrapper\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()); }
Return Example
$summoner = $raw->LOL()->Summoner('BR1')->byName('frosty');
array(7) { ["id"] => string(47) "d28PpG7Udqz1DC426V0xhBcExDZ21m8eYY9Ys9zhOOsKjNM" ["accountId"] => string(47) "f_WSG9mgV23Zxh132C_9d2o1DMYg3Rq9sPp_APHp1QGlcdA" ["puuid"] => string(78) "oB7jr-sPTP2Vs8Y6fglY345VFRdjNfxfPoAsXI3ViJbBlAmWCvN81igfZO88Y5_5JlCQreBKKO4uA" ["name"] => string(6) "frosty" ["profileIconId"] => int(5490) ["revisionDate"] => int(1681258365846) ["summonerLevel"] => int(813) }
Contributing
Contributions are welcome! If you find a bug or have a feature request, please open an issue.
License
RAW is open-source software licensed under the MIT license.