Download the PHP package cannonsir/weather without Composer
On this page you can find all versions of the php package cannonsir/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 天气信息组件。
安装
使用
在使用本扩展之前,你需要去 高德开放平台 注册账号,然后创建应用,获取应用的 API Key
获取实时天气
返回结果示例:
获取近期天气预报
返回结果示例
通过传递第最后一个参数可设置返回值类型:
json/xml
默认json
格式
参数说明
- $city - 城市名,比如:“深圳”;
- $type - 返回内容类型:live: 返回实况天气 / forecasts: 返回预报天气;
- $format - 输出的数据格式,默认为 json 格式,当 format 设置为 “xml” 时,输出的为 XML 格式的数据。
在 Laravel 中使用
在Laravel中使用也是同样的安装方式,配置写在 config/services.php 中:
然后在 .env
文件中配置 AMAP_API_KEY
参考
License
MIT
All versions of weather with dependencies
PHP Build Version
Package Version
Requires
guzzlehttp/guzzle Version
^6.3
The package cannonsir/weather contains the following files
Loading the files please wait ....