1. Go to this page and download the library: Download shamota/dotapi2 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/ */
shamota / dotapi2 example snippets
// Set your Steam API key
Client::setDefaultKey('your_api_key_here');
// Create wrapper
$client = new Client();
$filter = new Filters\Match();
$filter->setGameMode(GameModes::CAPTAINS__MODE);
$filter->setMinimumPlayers(10);
$filter->setAccountId(22785577);
// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchHistory($filter);
// Turns response into a Match collection
$matchCollection = $response->getCollection('Match');
// Loops through all the found matches and dispays the start time.
foreach ($matchCollection as $match) {
echo $match->getStartTime()->format('d-m-Y H:i:s') . PHP_EOL;
}
// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchHistoryBySequenceNumber(new Filters\MatchSequence(2040184605, 10));
// Turns response into a Match collection
$matchCollection = $response->getCollection('Match');
// Loops through all the found matches and dispays the start time.
foreach ($matchCollection as $match) {
echo $match->getStartTime()->format('d-m-Y H:i:s') . PHP_EOL;
}
// Returns a Response object that contains the raw body and JSON data.
$response = $client->getMatchDetails(new Filters\MatchDetails(2197925777));
// Turns response into a DetailedMatch collection
$match = $response->getEntity('DetailedMatch');
// Get Dire players
$direPlayers = $match->getPlayers()->getDire();
// Get a specific player
$specificPlayer = $match->getPlayers()->getById(22785577);
$specificPlayerHero = $specificPlayer->getHeroId();
$specificPlayerKills = $specificPlayer->getKills();
// Get Picks and Bans sequence if matchtype has picks and bans
$pickBanSequence = $match->getPicksBans();
$response = $client->getLeagueListing();
$response = $client->getLiveLeagueGames();
$response = $client->getScheduledLeagueGames();
// Puppey (87278757) in The Shanghai Major (4266)
$response = $client->getFantasyPlayerStats(new Filters\FantasyPlayerStats(4266, 87278757));