Skip to content

xitox97/laravel-opendota

Repository files navigation

Laravel-OpenDota

Latest Version on Packagist Total Downloads

Unofficial Laravel 7 PHP Facade/Wrapper for the OpenDota API

laravel-Opendota

Support

  • Laravel 7+
  • OpenDota API (v18.0.0)

All API endpoint supported except explorer and FindMatches

Installation

You can install the package via composer:

composer require xitox97/laravel-opendota

API KEY Set up (Optional)

Publish Laravel Opendota config by run below command, and replace the null value with your api-key.

php artisan vendor:publish --provider Xitox97\LaravelOpendota\LaravelOpendotaServiceProvider --tag="config"

Usage

Every function are return an instance of Illuminate\Http\Client\Response, Therefore you can use variety of method provided by Laravel HTTP Client. Check more function in LaravelOpenDota

Get player info without Parameter

$player = Opendota::getPlayer($player_id);
$player->json();
$player->body();
etc...

Get player win lose with Parameter

Refer OpenDota Documentation to know more about exact parameter supported for each endpoint

$playerWinLose = Opendota::getPlayerWL(311360822,['limit' => 1000])->json();

Get match details

$player = Opendota::getMatch($match_id);

Get players ordered by rank/medal tier

$player = Opendota::getPlayersByRank();

Get list of pro players

$player = Opendota::getProPlayers();

Get list of pro matches

$player = Opendota::proMatches();

Get list of randomly sampled public matches

$player = Opendota::publicMatches();

To view more function just open the LaravelOpenDota file. The function name is similar to OpenDota endpoint.

Credits

License

Copyright © 2020 Farhan Hadi (farhan.abdhadi@gmail.com)

The MIT License (MIT). Please see License File for more information.