2017 © Pedro Peláez
 

library champion

Champion.gg API wrapper written in PHP

image

m1so/champion

Champion.gg API wrapper written in PHP

  • Wednesday, December 30, 2015
  • by m1so
  • Repository
  • 1 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 13 % Grown

The README.md

Champion

Champion.gg API wrapper written in PHP., (*1)

Installation:
Require this package using composer composer require m1so/champion, (*2)

Disclaimer: The internal API of this package may change, use at own risk, (*3)

Todo: - Exception handling - More examples and usecases - Add tests, (*4)

Documentation

Overview of all methods and endpoints with examples., (*5)

Usage

Set you API key using, (*6)

use Champion\ChampionAPI;
// ...
ChampionAPI::setKey($yourKeyHere);

Always remember to use or fully qualify the namespace, (*7)

use Champion\Stats;
// ...
$stats = Stats::byRole('Top');
// or
$stats = \Champion\Stats::byRole('Top');

Champion specific

List of all endpoints and methods that are specific to a given champion., (*8)

All champions

Endpoint: /champion
Example:, (*9)

$champions = Champion::all();

Champion info

Endpoint: /champion/:name
Example:, (*10)

// Grab all data for given champion
$ahriInfo = (new Champion('Ahri'))->info();

Endpoint: /champion/:name/general
Example:, (*11)

// Grab only general data for given champion
$ahriGeneral = (new Champion('Ahri'))->general();

Champion matchups

Endpoint: /champion/:name/matchup Example:, (*12)

// All matchups for champion
$matchups = (new Champion('TwistedFate'))->matchups();

Finished items for champion

Endpoint: /champion/:name/items/finished/{mostPopular, mostWins}
Example:, (*13)

// 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 for champion

Endpoint: /champion/:name/skills/{mostPopular, mostWins}
Example:, (*14)

// 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);

Starting items

Endpoint: /champion/:name/items/starters/{mostPopular, mostWins} Example:, (*15)

// Same flags apply (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$startingItems = (new Champion($name))->startingItems();

Summoner spells

Endpoint: /champion/:name/summoners/{mostPopular, mostWins}
Example:, (*16)

// Same flags apply (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$summs = (new Champion($name))->summonerSpells();

Runes

Endpoint: /champion/:name/runes/{mostPopular, mostWins}
Example:, (*17)

// Same flags apply for runes (Champion::CHAMPION_MOST_WINS and Champion::CHAMPION_MOST_POPULAR)
$runes = (new Champion($name))->runes();

Matchup between two champions

Endpoint: /champion/:name/matchup/:enemy
Example:, (*18)

// Matchup between two champions
$matchup = Matchup::info($as, $vs);
// TODO: Consider adding Matchup::between($as, $vs) syntax

Stats

Stats related endpoints and methods, (*19)

All stats

Endpoint: /stats
Example:, (*20)

// Grab all stats
$stats = Stats::all();

All stats for all roles

Endpoint: /stats/role
Example:, (*21)

$allRoles = Stats::allRoles();

Choosing a specific role for stats

Endpoint: /stats/role/:role/{mostImproved, leastImproved, leastWinning, mostWinning, worstPerformance, bestPerformance} [page, limit]
Example:, (*22)

// 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);

Endpoint: /stats/champs/:name
Example:, (*23)

$ahriStats = Stats::byChampion('Ahri');

General champion stats

Endpoint: /stats/champs/{mostBanned, leastWinning, leastPlayed, mostPlayed, mostWinning, bestRated, worstRated} [page, limit] Example:, (*24)

// Flag is required here:
// By bans
$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);

The Versions

30/12 2015

dev-master

9999999-dev

Champion.gg API wrapper written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Baumgartner

30/12 2015

v0.0.1

0.0.1.0

Champion.gg API wrapper written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michal Baumgartner