focus-sports-labs/fsl-data-center

Focus Sports Labs 数据中心 API 的 PHP SDK


README

这是一个用于FSL 数据中心 API的简单 PHP SDK。

使用此 SDK,您可以轻松地与 FSL 数据中心 API 进行通信

以下是提供的一些方法示例

use FocusSportsLabs\FslDataCenter\Client;
use FocusSportsLabs\FslDataCenter\HttpClient\Options;

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$options = new Options([
    'auth_token' => 'token', // get this from your application profile
    'origin' => 'https://', // you set this when creating your application
]);

$client = new Client($options);
$response = $client->countries()->list();

// this would give you a list of all countries supported by FSL
dump($response);

要求

要使用此项目,您需要

安装

您可以通过运行以下命令使用 composer 安装该软件包

composer require focus-sports-labs/data-center-php-sdk

如何获取 API 密钥

首先,您需要在FSL 数据中心 API创建或登录您的账户

Image of login page

Image of registeration page

接下来,创建一个应用程序以获取 API 密钥和源

Image of create application page

请务必复制您的 API 密钥,因为您在设置客户端时需要它。

用法

首先实例化客户端

use FocusSportsLabs\FslDataCenter\Client;
use FocusSportsLabs\FslDataCenter\HttpClient\Options;

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$options = new Options([
    'auth_token' => 'token', // get this from your application profile
    'origin' => 'https://', // you set this when creating your application
]);

$client = new Client($options);

现在您有了客户端,您可以访问所有可用的端点。如下所示

<?php

// use the request helper to access endpoints
$countries = $client->request('countries')->list();

// or use the magic method to access endpoints
$countries = $client->countries()->list();

更多信息即将到来

测试

使用以下命令运行测试

vendor/bin/pest

路线图

以下是待完成的任务列表

  • 为每个请求添加文档
  • 为每个请求添加测试

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献指南

安全

如果您发现有关安全性的错误,请通过abdulkudus2922@gmail.com发送电子邮件,而不是使用问题跟踪器。

鸣谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅许可文件