dolejska-daniel / riot-api-datadragon
Riot DataDragon API wrapper for PHP8
Fund package maintenance!
dolejska-daniel
www.paypal.me/dolejskad
Requires
- php: >=8.1
- ext-json: *
- dolejska-daniel/riot-api-league: ^2
- nette/utils: v4
This package is auto-updated.
Last update: 2024-11-20 18:23:56 UTC
README
Version v1.0.0
Table of Contents
Introduction
Welcome to the DataDragon PHP library repo! The goal of this library is to create easy-to-use library for anyone who might need one.
Here are some handy features:
- Profile icon URL and HTML embed generating
- Champion splash image URL and HTML embed generating
- Champion loading image URL and HTML embed generating
- Champion icon URL and HTML embed generating
- Sprite image URL and HTML embed generating
- Spell, passive, item and summoner spell icon URL and HTML embed generating
- Runes reforged icon URL and HTML embed generating
- Static resource (champions, spells, items, runes, ...) loading and processing
Please, refer mainly to the wiki pages. This file contains only general introduction to library features.
Downloading
The easiest way to download and use this library is via Composer. If you are not using Composer yet, you should start right now!
While having Composer installed on your machine it takes only composer require "dolejska-daniel/riot-api-datadragon:^1"
command to get the library ready to roll!
For additional information about downloading and initial setup, please see the wiki pages.
DataDragon API
How easy is it to work with static images? For instance, to get loading screen art of Orianna?
Source:
echo DataDragonAPI::getChampionLoading('Orianna'); echo DataDragonAPI::getChampionLoading('Orianna', 7);
Output:
<img alt="Orianna" class="dd-icon dd-loading" src="https://ddragon.leagueoflegends.com/cdn/img/champion/loading/Orianna_0.jpg"> <img alt="Orianna" class="dd-icon dd-loading" src="https://ddragon.leagueoflegends.com/cdn/img/champion/loading/Orianna_7.jpg">
Render:
...a bit of nostalgia?
Source:
DataDragonAPI::iniByVersion('0.151.2'); echo DataDragonAPI::getItemIcon(3132); echo DataDragonAPI::getItemIcon(3126); echo DataDragonAPI::getItemIcon(3138);
Output:
<img alt="3132" class="dd-icon dd-item" src="https://ddragon.leagueoflegends.com/cdn/0.151.2/img/item/3132.png"> <img alt="3126" class="dd-icon dd-item" src="https://ddragon.leagueoflegends.com/cdn/0.151.2/img/item/3126.png"> <img alt="3138" class="dd-icon dd-item" src="https://ddragon.leagueoflegends.com/cdn/0.151.2/img/item/3138.png">
Render:
...or to display icon of champion and its spells based on its object from API?
Source:
// ... $orianna = $api->getStaticChampion(61, true); echo DataDragonAPI::getChampionSplashO($orianna); foreach($orianna->spells as $spell) echo DataDragonAPI::getChampionSpellIconO($spell);
Output:
<img alt="Orianna" class="dd-icon dd-icon-champ" src="https://ddragon.leagueoflegends.com/cdn/8.24.1/img/champion/Orianna.png"> <img alt="OrianaIzunaCommand" class="dd-icon dd-spell" src="https://ddragon.leagueoflegends.com/cdn/8.24.1/img/spell/OrianaIzunaCommand.png"> <img alt="OrianaDissonanceCommand" class="dd-icon dd-spell" src="https://ddragon.leagueoflegends.com/cdn/8.24.1/img/spell/OrianaDissonanceCommand.png"> <img alt="OrianaRedactCommand" class="dd-icon dd-spell" src="https://ddragon.leagueoflegends.com/cdn/8.24.1/img/spell/OrianaRedactCommand.png"> <img alt="OrianaDetonateCommand" class="dd-icon dd-spell" src="https://ddragon.leagueoflegends.com/cdn/8.24.1/img/spell/OrianaDetonateCommand.png">
Render:
For more, please see the wiki pages. More usage examples for DataDragonAPI can be found here.