livecore-interactive/ /fpl-api
用于访问未文档化的https://fantasy.premierleague.com API的PHP库
dev-master
2020-09-09 00:40 UTC
Requires
- guzzlehttp/guzzle: ^6.3
- guzzlehttp/guzzle-services: ^1.1
This package is auto-updated.
Last update: 2024-09-09 09:12:36 UTC
README
用于访问未文档化的https://fantasy.premierleague.com API的PHP库
安装
使用composer
composer require livecore-interactive/fpl-api
使用github仓库
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/livecore-interactive/fpl-api"
}
],
"require": {
"livecore-interactive/fpl-api": "master"
}
}
使用库
use LivecoreInteractive\FplApi\FplApi;
$fpl = new FplApi();
$client = $fpl->getClient();
$auth = $fpl->getAuthClient();
////////////////////log in api
$auth->login([
'password'=>'password',
'login'=>'your-email',
'redirect_uri'=>'https://fantasy.premierleague.com/',
'app'=>'plfpl-web'
]);
API端点
https://fantasy.premierleague.com/api/bootstrap-static
$bootstrapStatic = $client->bootstrapStatic();
https://fantasy.premierleague.com/api/leagues-classic-standings/{leagueId}
$leaguesClassicStandings = $client->leaguesClassicStandings(['leagueId' => '123123']);
https://fantasy.premierleague.com/api/entry/{entryId}
$entry = $client->entry(['entryId' => '1234567']);
https://fantasy.premierleague.com/api/entry/{entryId}/history
$entryHistory = $client->entryHistory(['entryId' => '1234567']);
https://fantasy.premierleague.com/api/entry/{id}/event/{eventId}/picks
$data = $client->entryPicks(['entryId' => $entryId, 'eventId' => $eventId]);
https://fantasy.premierleague.com/api/element-summary/{elementId}
$elementSummary = $client->elementSummary(['elementId' => '123']);
术语
- 参赛者相当于一个参赛者
- 球员相当于一个元素
- 比赛周相当于一周,例如eventId => 2 表示第2周。