Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tinywan/webman-weather
the GaoDe weather for webman plugin
https://github.com/tinywan/webman-weather
php plugin plugins tinywan weather webman webman-framework workerman
Last synced: about 1 month ago
JSON representation
the GaoDe weather for webman plugin
- Host: GitHub
- URL: https://github.com/tinywan/webman-weather
- Owner: Tinywan
- License: mit
- Created: 2022-04-12T11:24:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-12T12:37:39.000Z (over 2 years ago)
- Last Synced: 2024-10-31T20:13:03.590Z (about 2 months ago)
- Topics: php, plugin, plugins, tinywan, weather, webman, webman-framework, workerman
- Language: PHP
- Homepage: https://www.workerman.net/plugin/44
- Size: 63.5 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webman weather plugin
[![Latest Stable Version](http://poser.pugx.org/tinywan/weather/v)](https://packagist.org/packages/tinywan/weather)
[![Total Downloads](http://poser.pugx.org/tinywan/weather/downloads)](https://packagist.org/packages/tinywan/weather)
[![Latest Unstable Version](http://poser.pugx.org/tinywan/weather/v/unstable)](https://packagist.org/packages/tinywan/weather)
[![License](http://poser.pugx.org/tinywan/weather/license)](https://packagist.org/packages/tinywan/weather)
[![PHP Version Require](http://poser.pugx.org/tinywan/weather/require/php)](https://packagist.org/packages/tinywan/weather):rainbow: 基于[高德开放平台](https://lbs.amap.com/dev/id/newuser)的天气信息插件
## 安装
```sh
composer require tinywan/weather
```## 使用
### 配置
在使用本扩展之前,你需要去 [高德开放平台](https://lbs.amap.com/dev/id/newuser) 注册账号,然后创建应用,获取应用的 API Key。
### 获取实时天气
```php
$response = tinywan\Weather::liveWeather('杭州');
```
响应信息
```json
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "浙江",
"city": "杭州市",
"adcode": "330100",
"weather": "阴",
"temperature": "27",
"winddirection": "东",
"windpower": "≤3",
"humidity": "47",
"reporttime": "2022-04-12 20:02:04"
}
]
}
```响应参数
![live.png](./live.png)
### 获取近期天气预报
```php
$response = tinywan\Weather::forecastsWeather('杭州');
```响应信息
```json
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"forecasts": [
{
"city": "杭州市",
"adcode": "330100",
"province": "浙江",
"reporttime": "2022-04-12 20:02:04",
"casts": [
{
"date": "2022-04-12",
"week": "2",
"dayweather": "多云",
"nightweather": "阴",
"daytemp": "33",
"nighttemp": "19",
"daywind": "东",
"nightwind": "东",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2022-04-13",
"week": "3",
"dayweather": "中雨",
"nightweather": "小雨",
"daytemp": "22",
"nighttemp": "16",
"daywind": "西北",
"nightwind": "西北",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2022-04-14",
"week": "4",
"dayweather": "小雨",
"nightweather": "小雨",
"daytemp": "18",
"nighttemp": "16",
"daywind": "北",
"nightwind": "北",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2022-04-15",
"week": "5",
"dayweather": "小雨",
"nightweather": "小雨",
"daytemp": "15",
"nighttemp": "11",
"daywind": "东北",
"nightwind": "东北",
"daypower": "4",
"nightpower": "4"
}
]
}
]
}
```响应参数
![forecast.png](./forecast.png)