PHPackages                             leamare/simple-opendota-php - 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. leamare/simple-opendota-php

ActiveLibrary[API Development](/categories/api)

leamare/simple-opendota-php
===========================

Simple class interface to work with OpenDota API

1.1.0(5y ago)3572[2 issues](https://github.com/leamare/simple-opendota-php/issues)GPL-3.0PHPPHP &gt;=5.3.0

Since Nov 20Pushed 4y ago2 watchersCompare

[ Source](https://github.com/leamare/simple-opendota-php)[ Packagist](https://packagist.org/packages/leamare/simple-opendota-php)[ RSS](/packages/leamare-simple-opendota-php/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)DependenciesVersions (2)Used By (0)

Simple OpenDota API library for PHP
===================================

[](#simple-opendota-api-library-for-php)

### API version: 18.0.0

[](#api-version-1800)

Simple [OpenDota API](https://docs.opendota.com/) support for PHP.

Handles API cooldown (to not get banned), API key usage, usage of various instances of OpenDota, Cli reporting.

It's sync only version with weird methods naming. It's intended to be used for **simple** PHP scripts (cli ones in the first place). For Async version made for ReactPHP look for reactive-opendota-php.

Note: It doesn't have an implementation for /feed endpoint. The endpoint tends to be unstable and it also requires HTTP streams support which doesn't work well with sync PHP.

Requirements
------------

[](#requirements)

- PHP &gt;=5.3.0
- cURL in PHP

You can use Composer to check all the requirements.

How to use
----------

[](#how-to-use)

1. Include `simple_opendota.php` in your project
2. Create `new odota_api()` instance.

That's it. You can work with OpenDota API through `odota_api` methods. Every method returns associative array made out of JSON response.

You can find the list of methods and their API counterparts in [ENDPOINTS.md](ENDPOINTS.md).

Important Notes
---------------

[](#important-notes)

### Additional odota\_api() parameters

[](#additional-odota_api-parameters)

Full version: `odota_api($cli_report_status, $hostname, $cooldown, $api_key)`

- `$cli_report_status`: (bool) report about every action to console. **Default: `false`**
- `$hostname`: (string) address of OpenDota API instance you're going to work with. **Default: `"https://api.opendota.com/api/"`**
- `$cooldown`: (int) API's cooldown between requests in milliseconds. **Default: `1000` or `200` if API key was specified** (approximately 1 per second)
- `$api_key`: (string) OpenDota API Key. **Default: none**

If you need to skip one of parameters, you can left it empty for default value.

### Work modes

[](#work-modes)

Every method's last parameter is `$mode`. It may have one of three values:

- ` 0`: Safe mode, sleep until API is ready (default)
- ` 1`: Force mode, don't wait for API cooldown
- `-1`: Fast mode, drop request if API isn't ready

### Setting custom callbacks

[](#setting-custom-callbacks)

- `set_get_callback(function($url, $data) {})` for GET requests only
- `set_post_callback(function($url, $data) {})` for POST requests only
- `set_request_callback(function($url, $data, $post) {})` for all requests (recommended)

### API Endpoints with multiple parameters

[](#api-endpoints-with-multiple-parameters)

API Endpoints with multiple GET parameters (for example, `/players/{account_id}/matches`) use additional parameter:

- `$params`: (array) array of parameters. Every key is parameter's name, every value is its value.

It's second to last for the methods of those endpoints. Parameters names are directly translated to API endpoint, so if you'll need them, just check OpenDota Docs and use the same names.

To see what methods use `$params` array and what don't, check [ENDPOINTS.md](ENDPOINTS.md) (or you can check the code itself).

Example
-------

[](#example)

```
require "simple_opendota.php";

$od = new \SimpleOpenDotaPHP\odota_api();

$res = $od->match(1234567902);

$od = new odota_api(true);

$res = $od->player(123123123);

$od = new odota_api(true, "localhost", 100);

$res = $od->live();

$od->set_get_callback(function($url, $data) {
  return $url.' '.json_encode($data);
});

$od->set_request_callback(function($url, $data, $post) {
  return 'R '.$url.' '.json_encode($data);
});
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.3% 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

Unknown

Total

1

Last Release

1999d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/03b8084feedd9deed1d0bbef5d6a6a1d1b2741bdc8c89eeda1e21c964ea55978?d=identicon)[leamare](/maintainers/leamare)

---

Top Contributors

[![leamare](https://avatars.githubusercontent.com/u/2502223?v=4)](https://github.com/leamare "leamare (24 commits)")[![Cannoral](https://avatars.githubusercontent.com/u/98658605?v=4)](https://github.com/Cannoral "Cannoral (2 commits)")

---

Tags

dotadota2-apiopendotaopendota-apiphp

### Embed Badge

![Health badge](/badges/leamare-simple-opendota-php/health.svg)

```
[![Health](https://phpackages.com/badges/leamare-simple-opendota-php/health.svg)](https://phpackages.com/packages/leamare-simple-opendota-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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