PHP implementation of SC2Ranks API V2

1.1.1 2013-11-01 09:53 UTC


Build Status

A simple object-oriented implementation of the second version of SC2Ranks API. The implementation parses JSON returned from the SC2Ranks API server and doesn't do anything to manipulate it. Check out the API documentation for information on how the returned data is structured.

Package is still in development and can't be considered stable, but should be functional. Please report any problems via the Github issues page.


Install as a Composer package: composer require anlutro\sc2ranks-v2:dev-master


$sc2r = new \anlutro\SC2Ranks\SC2Ranks('my_api_key');

$player = $sc2r->getPlayerFromProfileUrl('');

try {
    $teams = $sc2r->getPlayerTeams($player);
} catch (\anlutro\SC2Ranks\SC2RanksException $e) {
    echo $e->getMessage();


  • setDefault(array $array) Pass an array of default values for league, region, bracket and expansion.
  • returnArray() Return associative arrays instead of objects.
  • getRemainingCredits() See how many remaining credits for API calls you have.
  • getsumCreditsSpent() Get the sum of credits spent during the class's lifetime.
  • getCreditsSpentLast() Get how many credits were spent on the last request.
  • getCreditsSpent() Get an array of the calls ran and how many credits were spent on each.

  • getPlayerFromProfileUrl($url) Get a Player object from a or SC2Ranks profile URL.

  • createPlayer($region, $bnetId) Get a Player object from region and ID.
  • getPlayerCharacter(Player $player) Get the character of a player.
  • getPlayerTeams(Player $player, $options = array()) Get the teams of a player.
  • searchCharacter($name, $options = array()) Search SC2Ranks for a name.
  • getBulkCharacters(array $players) Get a large number of characters. Must be an array of Player objects.
  • getBulkTeams(array $players, array $options = array()) Get a large number of teams.
  • getClanInfo($region, $tag, $options = array()) Get info about a clan.
  • getClanCharacters($region, $tag, $options = array()) Get the characters of a clan's members.
  • getClanTeams($region, $tag, $options = array()) Get the teams of a clan's members.
  • getDivisionInfo($divId) Get information on a division.
  • getDivisionTeams($divId, $limit = 10) Get the teams of a division.
  • getCdivInfo($cdivId) Get information on a custom division.
  • getCdivTeams($divId, $options = array()) Get the teams in a custom division.
  • getCdivCharacters($divId, $options = array()) Get the characters of a custom division.
  • addCdivPlayer($divId, Player $player) Add a player to a custom division.
  • removeCdivPlayer($divId, Player $player) Remove a player from a custom division.
  • addCdivPlayers and removeCdivPlayers can be used in the same way, but you can pass an array of Player objects to add/remove more than one at the time.


Open an issue on GitHub if you have any problems or suggestions.

If you have any questions or want to have a chat, look for anlutro @


The contents of this repository is released under the MIT license.