Download the PHP package zhuxiaojin/weather without Composer
On this page you can find all versions of the php package zhuxiaojin/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
安装
composer require zhuxiaojin/weather
配置
在使用本扩展之前,你需要注册高德开放平台 然后创建应用,获取API KEY
使用
use zhuxiaojin\Weather\Weather;
$key='XXXXXXXXXXXXXXXXXXXXXXXXX';
$weather=new Weather($key);
获取实时天气
$response = $weather->getWeather('深圳');
示例
`
获取近期天气预报(四天)
$response = $weather->getWeather('深圳', 'all');
示例
获取xml格式数据
$response = $weather->getWeather('深圳', 'base','xml');
示例
参数说明
getWeather($city,$type='base',$format='json')
- city 城市名称
- type 数据类型-base:实时信息 all:最近四天天气
- format 返回数据格式:json xml
在laravel中使用
安装方式相同,配置在config/services.php中
然后在.env中
WEATHER_API_KEY='#####################'
两种方式获取示例
参数注入
服务名访问
参考
LICENSE
MIT
All versions of weather with dependencies
PHP Build Version
Package Version
Requires
guzzlehttp/guzzle Version
^6.3
The package zhuxiaojin/weather contains the following files
Loading the files please wait ...