Download the PHP package jtipsy/weather without Composer
On this page you can find all versions of the php package jtipsy/weather. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package weather
weather
基于高德开放平台的PHP天气信息组件
安装
配置
使用
获取实时天气
示例:
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "内蒙古",
"city": "呼和浩特市",
"adcode": "150100",
"weather": "阴",
"temperature": "-9",
"winddirection": "北",
"windpower": "4",
"humidity": "53",
"reporttime": "2021-12-16 17:00:39"
}
]
}
获取近期天气预报
示例:
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"forecasts": [
{
"city": "呼和浩特市",
"adcode": "150100",
"province": "内蒙古",
"reporttime": "2021-12-16 17:00:39",
"casts": [
{
"date": "2021-12-16",
"week": "4",
"dayweather": "多云",
"nightweather": "晴",
"daytemp": "-4",
"nighttemp": "-17",
"daywind": "西北",
"nightwind": "西北",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2021-12-17",
"week": "5",
"dayweather": "晴",
"nightweather": "晴",
"daytemp": "-8",
"nighttemp": "-17",
"daywind": "西",
"nightwind": "西",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2021-12-18",
"week": "6",
"dayweather": "晴",
"nightweather": "晴",
"daytemp": "-3",
"nighttemp": "-14",
"daywind": "西",
"nightwind": "西",
"daypower": "4",
"nightpower": "4"
},
{
"date": "2021-12-19",
"week": "7",
"dayweather": "晴",
"nightweather": "晴",
"daytemp": "-1",
"nighttemp": "-11",
"daywind": "西",
"nightwind": "西",
"daypower": "4",
"nightpower": "4"
}
]
}
]
}
获取XML格式返回值
示例:
参数说明
在Laravel中使用
在 Laravel 中使用也是同样的安装方式,配置写在 config/services.php 中:
'weather' => [
'key' => env('WEATHER_API_KEY'),
],
可以用两种方式来获取 Jtipsy\Weather\Weather 实例:
public function edit(Weather $weather)
{
$response = $weather->getWeather('呼和浩特市');
}
public function edit()
{
$response = app('weather')->getWeather('深圳');
}
参考
License
MIT# weather
All versions of weather with dependencies
PHP Build Version
Package Version
Requires
guzzlehttp/guzzle Version
^7.4
The package jtipsy/weather contains the following files
Loading the files please wait ....