PHP code example of losingbattle / opendota

1. Go to this page and download the library: Download losingbattle/opendota 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/ */

    

losingbattle / opendota example snippets




use OpenDota\Application;

$options = [
    'api_key'     => 'xxx', (选填 在官网申请后使用 取消每天调用次数限制),
    'log' => [
        'file' => __DIR__.'/opendota.log',
    ],
    'http' => [
        'retry'=>2
    ],
];

$app = new Application($options);

$heros = $app->heroes;
$teams = $app->teams;
(其他接口参考文档和phpstrom ctrl跳进去看 - -)
$heros->data();
$heros->recent_matches($hero_id);