destyk/escore-api-php

此包已被废弃,不再维护。未建议替换包。

ESCore.gg 的非官方 API

1.0.0 2022-07-15 18:18 UTC

This package is auto-updated.

Last update: 2023-01-15 19:27:24 UTC


README

基于 PHP 编写的 escore.gg 的非官方 API

Made with PHP Repo size issues Downloads Downloads

🔑 库安装

您可以使用 composer 安装此库

composer require destyk/escore-api-php

📝 使用此库

require('vendor/autoload.php');

use DestyK\EScore\Signature;
use DestyK\EScore\API;
use DestyK\EScore\RequestException;

try {
    $signature = new Signature();
    $api = new API($signature);
    
    // There will be an array with data about ALL UPCOMING matches
    $response = $api->getUpcoming();
    
    ...
    
    // There will be an array with data about CSGO UPCOMING matches
    $response = $api->getUpcoming([
        'gameType' => 3
    ]);
} catch(RequestException $e) {
    echo $e->getMessage();
}

📂 可用方法

📌 方法 $api->getUpcoming(array $body, array $query)

返回即将举行的比赛列表

...
// There will be an array with data about ALL UPCOMING matches
$response = $api->getUpcoming();

// There will be an array with data about CSGO UPCOMING matches
$response = $api->getUpcoming([
    'gameType' => 3
]);

错误时返回 \DestyK\EScore\RequestException 类的对象。

📌 方法 $api->getLive(array $body, array $query)

返回已开始比赛的比赛列表

...
// There will be an array with data about ALL LIVE matches
$response = $api->getLive();

// There will be an array with data about DOTA 2 LIVE matches
$response = $api->getLive([
    'gameType' => 4
]);

错误时返回 \DestyK\EScore\RequestException 类的对象。

📌 方法 $api->getFinished(array $body, array $query)

返回已开始比赛的比赛列表

...
// There will be an array with data about ALL FINISHED matches
$response = $api->getFinished();

// There will be an array with data about LOL FINISHED matches
$response = $api->getFinished([
    'gameType' => 1
]);

错误时返回 \DestyK\EScore\RequestException 类的对象。

📂 游戏ID

ALL - 0
CS:GO - 3
Dota 2 - 4
LOL - 1