skizu/simpleapi
Composer 安装命令:
composer require skizu/simpleapi
包简介
Simple api wrapper with easy caching and throttling
README 文档
README
A simple api wrapper with quick and easy caching and throttling.
Configuration
To configure a new api key you must register it in the .env where in the example EXAMPLE_KEY is the key.
# Required EXAMPLE_KEY_API_URL=http://api.example.com/ # Optional EXAMPLE_KEY_API_THROTTLE_LIMIT=100 EXAMPLE_KEY_API_STORAGE_TIME=1440 EXAMPLE_KEY_API_CACHE_TIME=60
Usage
Example to resolve http://api.example.com/baz?foo=bar
$api = new SimpleAPI\RegisterAPI('example_key'); $query = [ 'foo' => 'bar' ]; $result = $api->action('baz')->lookup($query);
Error handling
This library works by throwing exceptions which you would need to catch.
- Invalid configuration
ConfigException - Throlled API
ThrottleException - Request error
RequestException - Response error
ResponseException - Server error
ServerException
统计信息
- 总下载量: 170
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-30