{"id":36992339,"url":"https://github.com/leamare/simple-opendota-php","last_synced_at":"2026-01-13T23:44:30.771Z","repository":{"id":54516570,"uuid":"124325451","full_name":"leamare/simple-opendota-php","owner":"leamare","description":"Simple OpenDota API library for PHP","archived":false,"fork":false,"pushed_at":"2021-10-31T20:29:09.000Z","size":38,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-04T12:10:15.477Z","etag":null,"topics":["dota","dota2-api","opendota","opendota-api","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leamare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-08T02:34:14.000Z","updated_at":"2023-05-21T21:25:16.000Z","dependencies_parsed_at":"2022-08-13T18:20:54.219Z","dependency_job_id":null,"html_url":"https://github.com/leamare/simple-opendota-php","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/leamare/simple-opendota-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leamare%2Fsimple-opendota-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leamare%2Fsimple-opendota-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leamare%2Fsimple-opendota-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leamare%2Fsimple-opendota-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leamare","download_url":"https://codeload.github.com/leamare/simple-opendota-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leamare%2Fsimple-opendota-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dota","dota2-api","opendota","opendota-api","php"],"created_at":"2026-01-13T23:44:30.696Z","updated_at":"2026-01-13T23:44:30.760Z","avatar_url":"https://github.com/leamare.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple OpenDota API library for PHP\r\n\r\n### API version: 18.0.0\r\n\r\nSimple [OpenDota API](https://docs.opendota.com/) support for PHP.\r\n\r\nHandles API cooldown (to not get banned), API key usage, usage of various instances of OpenDota, Cli reporting.\r\n\r\nIt'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.\r\n\r\nNote: 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.\r\n\r\n## Requirements\r\n\r\n* PHP \u003e=5.3.0\r\n* cURL in PHP\r\n\r\nYou can use Composer to check all the requirements.\r\n\r\n## How to use\r\n\r\n1. Include `simple_opendota.php` in your project\r\n2. Create `new odota_api()` instance.\r\n\r\nThat's it. You can work with OpenDota API through `odota_api` methods. Every method returns associative array made out of JSON response.\r\n\r\nYou can find the list of methods and their API counterparts in [ENDPOINTS.md](ENDPOINTS.md).\r\n\r\n## Important Notes\r\n\r\n### Additional odota_api() parameters\r\n\r\nFull version: `odota_api($cli_report_status, $hostname, $cooldown, $api_key)`\r\n\r\n* `$cli_report_status`: (bool) report about every action to console. **Default: `false`**\r\n* `$hostname`: (string) address of OpenDota API instance you're going to work with. **Default: `\"https://api.opendota.com/api/\"`**\r\n* `$cooldown`: (int) API's cooldown between requests in milliseconds. **Default: `1000` or `200` if API key was specified** (approximately 1 per second)\r\n* `$api_key`: (string) OpenDota API Key. **Default: none**\r\n\r\nIf you need to skip one of parameters, you can left it empty for default value.\r\n\r\n### Work modes\r\n\r\nEvery method's last parameter is `$mode`. It may have one of three values:\r\n\r\n* ` 0`: Safe mode, sleep until API is ready (default)\r\n* ` 1`: Force mode, don't wait for API cooldown\r\n* `-1`: Fast mode, drop request if API isn't ready\r\n\r\n### Setting custom callbacks\r\n\r\n* `set_get_callback(function($url, $data) {})` for GET requests only\r\n* `set_post_callback(function($url, $data) {})` for POST requests only\r\n* `set_request_callback(function($url, $data, $post) {})` for all requests (recommended)\r\n\r\n### API Endpoints with multiple parameters\r\n\r\nAPI Endpoints with multiple GET parameters (for example, `/players/{account_id}/matches`) use additional parameter:\r\n\r\n* `$params`: (array) array of parameters. Every key is parameter's name, every value is its value.\r\n\r\nIt'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.\r\n\r\nTo see what methods use `$params` array and what don't, check [ENDPOINTS.md](ENDPOINTS.md) (or you can check the code itself).\r\n\r\n## Example\r\n\r\n```PHP\r\n\r\nrequire \"simple_opendota.php\";\r\n\r\n$od = new \\SimpleOpenDotaPHP\\odota_api();\r\n\r\n$res = $od-\u003ematch(1234567902);\r\n\r\n$od = new odota_api(true);\r\n\r\n$res = $od-\u003eplayer(123123123);\r\n\r\n$od = new odota_api(true, \"localhost\", 100);\r\n\r\n$res = $od-\u003elive();\r\n\r\n$od-\u003eset_get_callback(function($url, $data) {\r\n  return $url.' '.json_encode($data);\r\n});\r\n\r\n$od-\u003eset_request_callback(function($url, $data, $post) {\r\n  return 'R '.$url.' '.json_encode($data);\r\n});\r\n\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleamare%2Fsimple-opendota-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleamare%2Fsimple-opendota-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleamare%2Fsimple-opendota-php/lists"}