hristonev/sportmonks-client-bundle
Composer 安装命令:
composer require hristonev/sportmonks-client-bundle
包简介
Easily talk to an SportMonks API in Symfony
README 文档
README
API Version support
This API Client supports SportMonks v2.0.
Requirements
- PHP 5.6 or higher
Installation
composer require hristonev/sportmonks-client-bundle
Configuration
// Bootstrap require 'vendor/autoload.php'; use SportMonks\API\HTTPClient as SportMonksAPI; use SportMonks\API\Utilities\Auth; // Default values. Can be initialized without arguments. $scheme = 'https'; $hostname = 'sportmonks.com'; $subDomain = 'soccer'; $port = 443; // Auth. $token = 'open sesame'; $client = new SportMonksAPI(); // or //$client = new SportMonksAPI($scheme, $hostname, $subDomain, $port); // Set auth. $client->setAuth(Auth::BASIC, [ 'token' => $token ]);
Usage example
Paginated resource
$data = []; do{ $data = array_merge($data, $client->countries()->findAll()); }while($client->countries()->nextPage()); print_r($data);
Reference
Include data
$seasonId = 6361; $teamId = 85; $client->squad()->getBySeasonAndTeam( $seasonId, $teamId, [ 'query' => [ 'include' => 'player,position' ] ] )
Above example, includes player info and player-position info into collection. Check for more query parameters.
Basic methods endpoints
Basic methods find({id}), findAll(), nextPage(). nextPage() is used on paginated response.
- continents
- countries
- leagues
- seasons
- find(id, true)
Include results. - standings(season_id)
- standingsLive(season_id)
- topScorers(season_id)
- find(id, true)
- fixtures
- between()->period(from, to, teamId)
Params from and to are DateTime objects, teamId is integer. TeamId is optional. - date()->day(date)
Param is DateTime object. - commentaries(fixture_id)
- videoHighlights(fixture_id)
- tvStations(fixture_id)
- odds(fixture_id)
- oddsByBookmaker(fixture_id, bookmaker_id)
- oddsByMarket(fixture_id, market_id)
- oddsInPlay(fixture_id)
Fixtures does not support findAll method.
- between()->period(from, to, teamId)
- teams
- find(id, true)
Include stats. - season(id)
Get teams by season. Teams does not support findAll method.
- find(id, true)
- head2Head
- get(array)
Array must contain 2 elements(team1_id,team2_id). There is no additional mthods.
- get(array)
- liveScores
- today()
- inPlay()
- highlights
Video haighlights does not support find method. Additional method in fixtures is presented.
- venues
Venue does not support findAll method.
- bookmakers
- players
Players does not support findAll method.
- squad
- getBySeasonAndTeam(season_id, team_id)
No other methods
- getBySeasonAndTeam(season_id, team_id)
hristonev/sportmonks-client-bundle 适用场景与选型建议
hristonev/sportmonks-client-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.24k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2017 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hristonev/sportmonks-client-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hristonev/sportmonks-client-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-30