slvler/livescore-service
Composer 安装命令:
composer require slvler/livescore-service
包简介
live score service API for api-football.com
关键字:
README 文档
README
Live Score Client for api-football.com
Welcome to Api-Football! You can use our API to access all API endpoints, which can get information about Football Leagues & Cups.
Requirements
- PHP 8.1
- Laravel 9.x | 10.x
Installation
To install this package tou can use composer:
composer require slvler/livescore-service
Usage
- First, you should extract the config/livescore.php file to the config folder.
php artisan vendor:publish --tag=livescore
- API key to be obtained from api-football.com address should be declared. This is your private API key, specific to this API.
'livescore' => [ 'base_url' => 'v3.football.api-sports.io', 'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ]
Basic usage
Example
use Slvler\LiveScoreService\LiveScoreClient; $client = new LiveScoreClient();
Available methods
General
Status
Get the list status
$client->general()->getStatus();
Countries
Countries
Get the list of available countries for the leagues endpoint.
$client->countries()->getAll();
The name and code fields can be used in other endpoints as filters.
$client->countries()->getAll(['code' => 'FR']);
Leagues
Countries
Get the list of available leagues and cups. This endpoint also returns the coverage of each competition, which makes it possible to know what is available for that league or cup.
$client->leagues()->getLeagues(['season' => '2018', 'id' => '33']);
Seasons
All seasons are only 4-digit keys, so for a league whose season is 2018-2019 like the English Premier League (EPL), the 2018-2019 season in the API will be 2018.
$client->leagues()->getLeaguesSeasons();
Teams
Teams Information
Get the list of available teams. The team id are unique in the API and teams keep it among all the leagues/cups in which they participate.
$client->team()->getTeamsInformation(['name' => 'manchester united']);
Teams Statistics
The team id are unique in the API and teams keep it among all the leagues/cups in which they participate.
$client->team()->getTeamsStatistics(['league' => '39', 'team' => '33', 'season' => '2019']);
Teams Seasons
Get the list of seasons available for a team.
$client->team()->getTeamsSeasons(['team' => '33']);
Teams Countries
Get the list of countries available for the teams endpoint.
$client->team()->getTeamCountries();
Venues
Venues
Get the list of available venues. The venue id are unique in the API.
$client->venues()->getVenues(['name' => 'Old Trafford']);
Standings
Standings
Get the standings for a league or a team. Return a table of one or more rankings according to the league / cup.
$client->standings()->getStandings([ 'league' => '39', 'season' => '2019']);
Fixtures
Rounds
Get the rounds for a league or a cup. The round can be used in endpoint fixtures as filters
$variable = $client->fixtures()->getRounds(['league' => '39', 'season' => 2019]);
Fixtures
For all requests to fixtures you can add the query parameter timezone to your request in order to retrieve the list of matches in the time zone of your choice like “Europe/London“
$client->fixtures()->getFixtures(['id' => '215662']);
Head To Head
Get heads to heads between two teams.
$client->fixtures()->getHeadToHead(['h2h' => '33-34']);
Statistics
Get the statistics for one fixture.
$client->fixtures()->getStatistics(['fixture' => '215662']);
Events
Get the events from a fixture.
$client->fixtures()->getEvents(['fixture' => '215662']);
Lineups
Get the lineups for a fixture. Lineups are available between 20 and 40 minutes before the fixture when the competition covers this feature. You can check this with the endpoint leagues and the coverage field.
$client->fixtures()->getLineups(['fixture' => '592872']);
Players statistics
Get the players statistics from one fixture.
$client->fixtures()->getPlayersStatistics(['fixture' => '169080']);
Injuries
Injuries
Get the list of players not participating in the fixtures for various reasons such as suspended, injured for example
$client->injuries()->getInjuries(['league' => '2', 'season' => '2020']);
Predictions
Predictions
Get predictions about a fixture. The predictions are made using several algorithms including the poisson distribution, comparison of team statistics, last matches, players etc…
$client->predictions()->getPredictions(['fixture' => '198772']);
Coachs
Coachs
Get all the information about the coachs and their careers.
$client->coachs()->getCoachs(['id' => '1']);
Players
Seasons
Get all available seasons for players statistics.
$client->players()->getSeasons(['player' => '276']);
Players
Get players statistics.
$client->players()->getPlayers(['id' => '19088', 'season' => '2018']);
Squads
Return the current squad of a team when the team parameter is used. When the player parameter is used the endpoint returns the set of teams associated with the player.
$client->players()->getSquads(['team' => '33']);
Top Scorers
Get the 20 best players for a league or cup.
$client->players()->getTopScorers(['season' => '2018', 'league' => '61']);
Top Assists
Get the 20 best players assists for a league or cup.
$client->players()->getTopAssists(['season' => '2020', 'league' => '61']);
Top Yellow Cards
Get the 20 players with the most yellow cards for a league or cup.
$client->players()->getTopYellowCards(['season' => '2020', 'league' => '61']);
Top Red Cards
Get the 20 players with the most red cards for a league or cup.
$client->players()->getTopRedCards(['season' => '2020', 'league' => '61']);
Transfers
Transfers
Get all available transfers for players and teams
$client->transfer()->getTransfer(['player' => '35845']);
Trophies
Transfers
Get all available trophies for a player or a coach.
$client->trophies()->getTrophies(['player' => '35845']);
Sidelined
Sidelined
Get all available sidelined for a player or a coach.
$client->sidelined()->getSidelined(['player' => '276']);
Odds
Odds / Live
This endpoint returns in-play odds for fixtures in progress.
$client->odds()->getOddsLive();
Odds / Live / Bets
Get all available bets for in-play odds.
$client->odds()->getOddsLivBets(['id' => "1"]);
Odds
Get odds from fixtures, leagues or date.
$client->odds()->getOdds(['date' => "2020-05-15"]);
Mapping
Get the list of available fixtures id for the endpoint odds.
$client->odds()->getOddsMapping();
Bookmakers
Get all available bookmakers.
$client->odds()->getOddsBookmakers();
Bets
Get all available bets for pre-match odds.
$client->odds()->getOddsBets();
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
Contributing
You're very welcome to contribute. Please see CONTRIBUTING for details.
slvler/livescore-service 适用场景与选型建议
slvler/livescore-service 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 462 次下载、GitHub Stars 达 28, 最近一次更新时间为 2023 年 03 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「laravel」 「livescore」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slvler/livescore-service 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slvler/livescore-service 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slvler/livescore-service 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
Laravel package for Accurate Online API integration.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
Shared RCX Laravel DataTables UI and configuration helpers.
统计信息
- 总下载量: 462
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-20