A PHP library to conveniently access and query the BrawlStars API. It includes a pre-defined set of classes that initialise themselves dynamically from API responses.
This package uses the official BrawlStars API. For more information, please visit https://developer.brawlstars.com/
To read the brawlstars-php documentation please vist https://ahsan112.gitbook.io/brawlstars-php/
To use this package, you need to obtain an API key at https://developer.brawlstars.com/
composer require ahsan112/brawlstars-php
When instantiating the BrawlStarsClient, you have to provide your API key:
$client = new BrawlStarsClient('key');
Refers to /players
endpoint from the official docs.
$player = $client->getPlayer('tag');
A Player object is returned
$player->soloVictories()
$player->highestTrophies()
$player->brawlers();
$player->brawlers()->brawler('leon');
$player->brawlers()->brawler('leon')->power();
For more methods read the brawlstars-php documentation.
$battleLog = client->getPlayerBattleLog('tag');
$battleLog->all() // retrives all battles as BattleLogList Object
$battleLog->latest() // retrives the most recent battle by the player
$battleLog->latest()->result();
$battleLog->latest()->teams();
For more methods read the brawlstars-php documentation.
Refers to /clubs/{clubTag}
endpoint from the official docs.
$club = $client->getClub('club tag'); // returns Club object
$club->name();
$club->description();
$club->members(); // ClubMembersList Object
For more methods read the brawlstars-php documentation.
$president = $club->president();
$president->name();
$president->trophies();
$vicePresidents = $club->vicePresidents();
$seniors = $club->seniors();
Refers to /rankings{countryCode}/seasons/{seasonId}
endpoint from the official docs.
$seasonRanking = $client->getSeasonRanking(); // default is ('global', 'latest')
$seasonRanking = $client->getSeasonRanking('gb', '56');
$seasonRanking->topTen();
$seasonRanking->first()->name();
$seasonRanking->first()->trophies();
Refers to /rankings{countryCode}/clubs
endpoint from the official docs.
$clubRanking = $client->getClubsRanking(); // default is ('global')
$clubRanking = $client->getClubsRanking('gb');
$clubRanking->topTen();
$clubRanking->first()->name();
$clubRanking->first()->trophies();
$clubRanking->first()->memberCount();
Refers to /rankings{countryCode}/brawlers/{brawlerId}
endpoint from the official docs.
$brawlerRanking = $client->getBrawlerRanking('brawler id');
$brawlerRanking->topTen();
$brawlerRanking->first()->name();
$brawlerRanking->first()->trophies();
$brawlerRanking->first()->club();
Refers to /rankings/{countryCode}/players
endpoint from the official docs.
$playerRanking = $client->getPlayerRanking('tag');
$playerRanking->topTen();
$playerRanking->first()->name();
$playerRanking->first()->trophies();
$playerRanking->first()->club();
For more methods read the brawlstars-php documentation.
Refers to /events/rotation
endpoint from the official docs.
$events = $client->getEvents();
$events->all();
$events->first()->startTime();
$events->first()->endTime();
$events->first()->map();
For more methods read the brawlstars-php documentation.