sockstack / weather
A weather SDK.
0.0.1
2018-10-31 09:20 UTC
Requires
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^7.4
This package is auto-updated.
Last update: 2024-12-20 15:06:13 UTC
README
Notice
这是一个测试案例,不可用于生产环境。
Installing
$ composer require sockstack/weather -vvv
Usage
use Sockstack\Weather\Weather; $weather = new Weather(); //json $response = $weather->get("北京市"); //array $response = $weather->get("北京市", true);
Response
json:
{ "data": { "yesterday": { "date": "30日星期二", "high": "高温 16℃", "fx": "北风", "low": "低温 1℃", "fl": "<![CDATA[<3级]]>", "type": "晴" }, "city": "北京", "aqi": "29", "forecast": [ { "date": "31日星期三", "high": "高温 17℃", "fengli": "<![CDATA[<3级]]>", "low": "低温 3℃", "fengxiang": "西南风", "type": "晴" }, { "date": "1日星期四", "high": "高温 17℃", "fengli": "<![CDATA[<3级]]>", "low": "低温 3℃", "fengxiang": "南风", "type": "晴" }, { "date": "2日星期五", "high": "高温 18℃", "fengli": "<![CDATA[<3级]]>", "low": "低温 5℃", "fengxiang": "南风", "type": "晴" }, { "date": "3日星期六", "high": "高温 17℃", "fengli": "<![CDATA[<3级]]>", "low": "低温 7℃", "fengxiang": "南风", "type": "多云" }, { "date": "4日星期天", "high": "高温 14℃", "fengli": "<![CDATA[3-4级]]>", "low": "低温 6℃", "fengxiang": "北风", "type": "多云" } ], "ganmao": "天凉,昼夜温差较大,较易发生感冒,请适当增减衣服,体质较弱的朋友请注意适当防护。", "wendu": "15" }, "status": 1000, "desc": "OK" }
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT