定制 nkl-kst/the-sports-db 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nkl-kst/the-sports-db

Composer 安装命令:

composer require nkl-kst/the-sports-db

包简介

PHP library to get sports data from TheSportsDB (https://www.thesportsdb.com)

README 文档

README

Build Packagist Version Coverage Status PHPStan Level GitHub

An easy-to-use PHP library to get data from https://www.thesportsdb.com.

Features

  • Get data for lists, livescores, lookups, schedules, searches or video highlights
  • Get results in serialized classes
  • Use your own API key
  • Throttle long-running scripts
  • Use PSR-4 autoloading
  • Supports PHP 7.4+

This library uses Semantic Versioning.

Installation

Install this PHP library with Composer.

> composer require nkl-kst/the-sports-db

Usage

Get data

Get sports data from TheSportsDB.

// You need to load the Composer autoload file somewhere in your code before
require_once 'vendor/autoload.php';

use NklKst\TheSportsDb\Client\ClientFactory;

// Create a client
$client = ClientFactory::create();

// Get soccer livescores
$livescores = $client->livescore()->now('Soccer');
echo $livescores[0]->strProgress;

// Get video highlights
$highlights = $client->highlight()->latest();
echo $highlights[0]->strVideo;

// Get next events for Liverpool FC
$events = $client->schedule()->teamNext(133602);
echo $events[0]->strEvent;

See integration tests for examples of all documented API calls.

Use your API key

Use your own Patreon API key.

use NklKst\TheSportsDb\Client\ClientFactory;

// Set an API key
$client = ClientFactory::create();
$client->configure()->setKey('YOUR_API_KEY');

Throttle requests

You are advised to do no more than 100 requests per minute to TheSportsDB API (the hard limit is two requests per second). If you have long-running scripts to gather many data, please consider to use the built-in rate limiter.

use NklKst\TheSportsDb\Client\ClientFactory;

// Use the default rate limit of 100 requests per minute
$client = ClientFactory::create();
$client->configure()->setRateLimiter();

// Do your requests as usual

// You can unset the rate limiter later
$client->configure()->unsetRateLimiter();

As this library uses the Symfony Rate Limiter Component, it's possible to use a custom rate limit mechanism. Please consult the Symfony documentation for more information.

Known issues

  • Livescores for v1 are not supported.
  • If you are getting an exception like JSON property "foo" in class "Bar" must not be NULL, then there is an entity attribute which should be nullable. Please open a new issue in this case.

Feedback

If you have any problems or questions, feel free to open an issue or a pull request.

Developer notes

Run tests and code checks.

# Unit tests
> composer test-unit

# Integration tests (API calls, Patreon key required)
> PATREON_KEY=<YOUR_PATREON_KEY> composer test-integration
# On Windows use 'set PATREON_KEY=<YOUR_PATERON_KEY>' before running the tests

# Analyze code (static analysis)
> composer analyze-code

# Check code (coding standards)
> composer check-code

License: MIT

See LICENSE.

nkl-kst/the-sports-db 适用场景与选型建议

nkl-kst/the-sports-db 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.21k 次下载、GitHub Stars 达 29, 最近一次更新时间为 2020 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「library」 「TheSportsDB」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nkl-kst/the-sports-db 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nkl-kst/the-sports-db 我们能提供哪些服务?
定制开发 / 二次开发

基于 nkl-kst/the-sports-db 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 29
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 29
  • Watchers: 4
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-30