yaroslavche/sportradar-php-client

SportRadar PHP 客户端

dev-main 2024-02-21 12:27 UTC

This package is auto-updated.

Last update: 2024-09-21 13:42:26 UTC


README

SportRadar 的 API 是 B2B(企业对企业)的,并不打算直接从客户端应用程序调用。期望的做法是从我们的 API 中提取数据,存储数据,然后直接向您的客户提供服务。 链接

依赖项

php >=8.1
symfony/http-client ^6.3
symfony/cache ^6.3

API 客户端

[ ] 公式 1 V1 [X] 公式 1 V2

示例

use SR\ApiClientFactory;
use SR\Exception\ApiClientExceptionInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Contracts\HttpClient\ResponseInterface;

$apiClientFactory = new ApiClientFactory(apiKey: 'your-api-key', cache: new FilesystemAdapter());
try {
    $formula1V2Client = $apiClientFactory->createFormula1Client();
    /** @var ResponseInterface $response */
    $response = $formula1V2Client->competitorMergeMappings();
    $response = $formula1V2Client->competitorProfile(competitorId: 'sr:competitor:178318');
    $response = $formula1V2Client->deletedStages(stageId: 'sr:stage:1031201');
    $response = $formula1V2Client->seasons();
    $response = $formula1V2Client->stageProbabilities(stageId: 'sr:stage:1031201');
    $response = $formula1V2Client->stageSchedule(stageId: 'sr:stage:1031201');
    $response = $formula1V2Client->stageSummary(stageId: 'sr:stage:1031201');
} catch (ApiClientExceptionInterface $exception) {
}