1. Go to this page and download the library: Download m1so/champion 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/ */
m1so / champion example snippets
use Champion\ChampionAPI;
// ...
ChampionAPI::setKey($yourKeyHere);
use Champion\Stats;
// ...
$stats = Stats::byRole('Top');
// or
$stats = \Champion\Stats::byRole('Top');
$champions = Champion::all();
// Grab all data for given champion
$ahriInfo = (new Champion('Ahri'))->info();
// Grab only general data for given champion
$ahriGeneral = (new Champion('Ahri'))->general();
// All matchups for champion
$matchups = (new Champion('TwistedFate'))->matchups();
// Grab all finished items (most popular is the default flag)
$popularItems = (new Champion($name))->items();
// Can be called explicitly
$popularItems = (new Champion($name))->items(Champion::CHAMPION_MOST_POPULAR);
// We can also get items by most wins this way
$mostWinsItems = (new Champion($name))->items(Champion::CHAMPION_MOST_WINS);
// Skill order (most popular is the default flag)
$popularItems = (new Champion($name))->skills();
// Can be called explicitly
$popularItems = (new Champion($name))->skills(Champion::CHAMPION_MOST_POPULAR);
// We can also get skills by most wins this way
$mostWinsItems = (new Champion($name))->skills(Champion::CHAMPION_MOST_WINS);
// Same flags apply (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$startingItems = (new Champion($name))->startingItems();
// Same flags apply (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$summs = (new Champion($name))->summonerSpells();
// Same flags apply for runes (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$runes = (new Champion($name))->runes();
// Matchup between two champions
$matchup = Matchup::info($as, $vs);
// TODO: Consider adding Matchup::between($as, $vs) syntax
// Grab all stats
$stats = Stats::all();
$allRoles = Stats::allRoles();
// Set the role's name
$name = 'Top';
// Set page and limit (default from Champion.gg API)
$page = 1;
$limit = 10;
$stats = Stats::byRole($name);
// We can also specify the flag:
$statsMostImproved = Stats::byRole($name, Stats::ROLE_MOST_IMPROVED, $page, $limit);
$statsLeastImproved = Stats::byRole($name, Stats::ROLE_LEAST_IMPROVED, $page, $limit);
$statsLeastWinning = Stats::byRole($name, Stats::ROLE_LEAST_WINNING, $page, $limit);
$statsMostWinning = Stats::byRole($name, Stats::ROLE_MOST_WINNING, $page, $limit);
$statsWorstPerf = Stats::byRole($name, Stats::ROLE_WORST_PERFORMANCE, $page, $limit);
$statsBestPerf = Stats::byRole($name, Stats::ROLE_BEST_PERFORMANCE, $page, $limit);
$ahriStats = Stats::byChampion('Ahri');
// Flag is
$champStats = Stats::champs(Stats::CHAMPION_MOST_BANNED, $page, $limit);
// By playrate
$champStats = Stats::champs(Stats::CHAMPION_MOST_PLAYED, $page, $limit);
$champStats = Stats::champs(Stats::CHAMPION_LEAST_PLAYED, $page, $limit);
// By winrate
$champStats = Stats::champs(Stats::CHAMPION_MOST_WINNING, $page, $limit);
$champStats = Stats::champs(Stats::CHAMPION_LEAST_WINNING, $page, $limit);
// By rating
$champStats = Stats::champs(Stats::CHAMPION_BEST_RATED, $page, $limit);
$champStats = Stats::champs(Stats::CHAMPION_WORST_RATED, $page, $limit);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.