mlntn/fpl-api
Composer 安装命令:
composer require mlntn/fpl-api
包简介
Fantasy Premier League API
README 文档
README
Requires omni-cache
Installation
Use composer:
{ "require": { "mlntn/fpl-api": "*", "mlntn/omni-cache": "*" }, "minimum-stability": "dev", "repositories": [ { "type": "git", "url": "https://github.com/mlntn/fpl-api" }, { "type": "git", "url": "https://github.com/mlntn/omni-cache" } ] }
Write a controller:
<?php $autoloader = require 'vendor/autoload.php'; $api = new Fpl\Api(new Cache\Provider\File('./cache', 86400)); $player = $api->getPlayer(323); die(json_encode($player)); // prettier with this: // json_encode($player, JSON_PRETTY_PRINT ^ JSON_UNESCAPED_UNICODE ^ JSON_UNESCAPED_SLASHES)
What does all that code above do?
The composer.json settings tell Composer to include this API and a caching tool I wrote called omni-cache.
The PHP controller sets up the autoloader, starts up a cache handler that caches to files for a maximum of 1 day, starts up the API class (passing in the cache handler) and grabs some player data (Artur Boruc) from fantasy.premierleague.com.
Check out Fpl\Api.php for other API methods.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-07-07