PHPackages                             sjaakmoes/dotapi2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sjaakmoes/dotapi2

ActiveLibrary[API Development](/categories/api)

sjaakmoes/dotapi2
=================

PHP DotA 2 API Client

1.0.3(10y ago)61262MITPHPPHP &gt;=5.6.0CI failing

Since Apr 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Droeftoeter/Dotapi2)[ Packagist](https://packagist.org/packages/sjaakmoes/dotapi2)[ Docs](https://github.com/Sjaakmoes/dotapi2)[ RSS](/packages/sjaakmoes-dotapi2/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

Dotapi2
=======

[](#dotapi2)

[![Build Status](https://camo.githubusercontent.com/77e0210a327c255cb348023b62478db0a915a16bca34e5b524e8b49da679fd6d/68747470733a2f2f7472617669732d63692e6f72672f536a61616b6d6f65732f446f74617069322e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Sjaakmoes/Dotapi2)[![Dependency Status](https://camo.githubusercontent.com/d54243b6e3d9424f92d30a64b930d82e2eeec5f2d7dc6719ac38600bb16ad195/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537323362636236626133376365303033316663316636642f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/5723bcb6ba37ce0031fc1f6d)[![Test Coverage](https://camo.githubusercontent.com/00209be4f6d61b263a3dfae5d7bb178d84af8d3f289a0dd130ba5420671336b0/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f536a61616b6d6f65732f446f74617069322f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Sjaakmoes/Dotapi2/coverage)[![Code Climate](https://camo.githubusercontent.com/b0f1b65338ad3e2181970fa3faf7bb235432a3f67c8ba5aace14c140e565ad75/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f536a61616b6d6f65732f446f74617069322f6261646765732f6770612e737667)](https://codeclimate.com/github/Sjaakmoes/Dotapi2)[![SensioLabsInsight](https://camo.githubusercontent.com/aba5e0ee735f213dcb59dc36f087839a317ded4f52a094d0d8127e94831508f5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35313236356631312d376331622d343132392d616562322d3736346364363464343532652f6d696e692e706e67)](https://insight.sensiolabs.com/projects/51265f11-7c1b-4129-aeb2-764cd64d452e)

Dota 2 API Wrapper for PHP

Reference
---------

[](#reference)

- [Installation](#installation)
- [Configuration](#configuration)
- [Supported Endpoints](#supported-endpoints)
- [getMatchHistory](#getmatchhistory)
- [getMatchHistoryBySequenceNumber](#getmatchhistorybysequencenumber)
- [getMatchDetails](#getmatchdetails)
- [getLeagueListing](#getleaguelisting)
- [getLiveLeagueGames](#getliveleaguegames)
- [getScheduledLeagueGames](#getscheduledleaguegames)
- [getFantasyPlayerStats](#getfantasyplayerstats)
- [getPlayerOfficialInfo](#getplayerofficialinfo)
- [getBroadcasterInfo](#getbroadcasterinfo)
- [getActiveTournamentList](#getactivetournamentlist)
- [getTeamInfo](#getteaminfo)
- [getTopLiveGame](#gettoplivegame)
- [getEventStatsForAccount](#geteventstatsforaccount)
- [getRealTimeStats](#getrealtimestats)
- [getGameItems](#getgameitems)
- [getItemIconPath](#getitemiconpath)
- [getSchemaUrl](#getschemaurl)
- [getHeroes](#getheroes)
- [getRarities](#getrarities)
- [getTournamentPrizePool](#gettournamentprizepool)
- [Steam ID Conversion](#steam-id-conversion)

Installation
------------

[](#installation)

This module can be installed with [Composer](https://getcomposer.org/). Add the dotapi2 package to your `composer.json` file:

```
{
    "require": {
        "sjaakmoes/dotapi2": "~1.0"
    }
}
```

You will also need a Steam API key, you can get one at .

Configuration
-------------

[](#configuration)

```
// Set your Steam API key
Client::setDefaultKey('your_api_key_here');

// Create wrapper
$client = new Client();
```

Supported Endpoints
-------------------

[](#supported-endpoints)

### getMatchHistory

[](#getmatchhistory)

Gets a filtered match history

```
$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;
}
```

### getMatchHistoryBySequenceNumber

[](#getmatchhistorybysequencenumber)

Gets a list of matches ordered by sequence number

```
// 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;
}
```

### getMatchDetails

[](#getmatchdetails)

Gets detailed information about a specific match

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

### getLeagueListing

[](#getleaguelisting)

Get information about DotaTV-supported leagues.

```
$response = $client->getLeagueListing();
```

### getLiveLeagueGames

[](#getliveleaguegames)

Get a list of in-progress league matches, as well as details of that match as it unfolds.

```
$response = $client->getLiveLeagueGames();
```

### getScheduledLeagueGames

[](#getscheduledleaguegames)

Get a list of scheduled league games coming up.

```
$response = $client->getScheduledLeagueGames();
```

### getFantasyPlayerStats

[](#getfantasyplayerstats)

Get fantasy player stats

```
// Puppey (87278757) in The Shanghai Major (4266)
$response = $client->getFantasyPlayerStats(new Filters\FantasyPlayerStats(4266, 87278757));
```

### getPlayerOfficialInfo

[](#getplayerofficialinfo)

Get official player information.

```
// Puppey (87278757)
$response = $client->getPlayerOfficialInfo(new Filters\AccountId(87278757));
```

### getBroadcasterInfo

[](#getbroadcasterinfo)

Get broadcaster info with the 64-bit Steam ID. If you need to convert, check [Steam ID Conversion](#steam-id-conversion).

```
// Requires the 64-bit Steam ID of a broadcaster.
$response = $client->getBroadcasterInfo(new Filters\BroadcasterInfo(76561197997412731));
```

### getActiveTournamentList

[](#getactivetournamentlist)

Gets list of active tournament

```
$response = $client->getActiveTournamentList();
```

### getTeamInfo

[](#getteaminfo)

Get team info

```
// Get team info for Team Secret (1838315). Filter is optional.
$response = $client->getTeamInfo(new Filters\TeamInfo(1838315));
```

### getTopLiveGame

[](#gettoplivegame)

Get the top live games.

```
$response = $client->getTopLiveGame(new Filters\TopLiveGame(0));
```

### getEventStatsForAccount

[](#geteventstatsforaccount)

Retrieve event statistics for account.

```
// Get stats for account 22785577 at The Shanghai Major (4266)
$response = $client->getEventStatsForAccount(new Filters\EventStats(4266, 22785577));
```

### getRealTimeStats

[](#getrealtimestats)

Retrieve real time stats about a match with a server steam id. You need a steam server id to get statistics, the top live games and some other tournament endpoint provide these for a match.

```
$response = $client->getRealTimeStats(new Filters\RealTimeStats(steam_server_id_here));
```

### getGameItems

[](#getgameitems)

Get a list of Dota2 in-game items.

```
$response = $client->getGameItems();
```

### getItemIconPath

[](#getitemiconpath)

Get the CDN path for a specific icon.

```
$response = $client->getItemIconPath(new Filters\ItemIconPath('enchanted_manglewood_staff', IconType::LARGE));
```

### getSchemaUrl

[](#getschemaurl)

Get the URL to the latest schema for Dota 2.

```
$response = $client->getSchemaUrl();
```

### getHeroes

[](#getheroes)

Get a list of heroes.

```
$response = $client->getHeroes();
```

### getRarities

[](#getrarities)

Get item rarity list.

```
$response = $client->getRarities();
```

### getTournamentPrizePool

[](#gettournamentprizepool)

Get the current pricepool for specific tournaments.

```
$response = $client->getTournamentPrizePool();
```

### Custom endpoint

[](#custom-endpoint)

You can also contact a custom endpoint on the Steam API:

```
$response = $client->get('IEconDOTA2_570/GetGameItems/v1', array|Filters\Filter $parameters);
```

Steam ID Conversion
-------------------

[](#steam-id-conversion)

If you have the [GMP](http://php.net/manual/en/intro.gmp.php) extension installed, Dotapi2 will allow you to convert 32-bit to 64-bit ID's and the other way around.

To convert a 32-bit ID:

```
$steamId = UserId::to64Bit('22785577'); // 76561197983051305
```

To convert a 64-bit ID:

```
$accountId = UserId::to32Bit('76561197983051305'); // 22785577
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

3712d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b5e48c428d633517e88886e4f93a05250e343cfceaa96a1f94117f74576eab3?d=identicon)[Droeftoeter](/maintainers/Droeftoeter)

---

Top Contributors

[![Droeftoeter](https://avatars.githubusercontent.com/u/10672650?v=4)](https://github.com/Droeftoeter "Droeftoeter (24 commits)")

---

Tags

apisteamdota

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sjaakmoes-dotapi2/health.svg)

```
[![Health](https://phpackages.com/badges/sjaakmoes-dotapi2/health.svg)](https://phpackages.com/packages/sjaakmoes-dotapi2)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k371.6k6](/packages/theodo-group-llphant)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[clicksend/clicksend-php

301.6M11](/packages/clicksend-clicksend-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[zyberspace/steam-web-api-client

Automatically generated api client for the Steam Web API in style of the google-api-php-client.

857.3k1](/packages/zyberspace-steam-web-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
