lfischer / wunderground-api
一个用于查询Weather Underground API的简单PHP库。
0.2.1
2020-10-30 15:16 UTC
Requires
- php: >=5.4.0
- ext-json: *
Requires (Dev)
- php: >=7.3
- phpunit/phpunit: ^9.4
- psalm/phar: ^4.1
This package is auto-updated.
Last update: 2024-09-29 04:55:01 UTC
README
此库将帮助您将WeatherUnderground API集成到您的webservice中。它非常轻量,并提供所有必要的代码。
代码示例
使用API非常简单 - 您只需提供API密钥(在此处获取)即可使用它。有按预定义条件检索不同天气数据的函数,例如“按国家和城市”,“按经纬度”,“按机场代码”或甚至“按IP地址”。
// By default the current conditions will be requested in english language. $weather = (new \lfischer\wunderground\API('<API-key here>'))->getByLocation('Germany', 'Dusseldorf');
运行测试
安装依赖项
composer install
然后运行测试
./vendor/bin/phpunit
取消注释配置文件phpunit.xml
中的<logging>
元素将在运行测试时生成覆盖率HTML文件。
未来的待办事项/想要拥有的
在某个时候,我想改进这个客户端,使其尽可能易于阅读。例如
use lfischer\wunderground; $weather = (new API('<API-key here>')) ->getConditions() ->byLocation('Germany', 'Dusseldorf') ->fetch() ->asArray();
贡献者
- Leonard Fischer - 初始编程 Github个人资料
- Stefano Borghi - 编写测试和改进代码 Github个人资料