LaravelPackages.net
Acme Inc.
Toggle sidebar
oscarmx/laravel-weather

a weather test SDK

7
2
1.0.1
About oscarmx/laravel-weather

oscarmx/laravel-weather is a Laravel package for a weather test sdk. It currently has 2 GitHub stars and 7 downloads on Packagist (latest version 1.0.1). Install it with composer require oscarmx/laravel-weather. Discover more Laravel packages by oscarmx or browse all Laravel packages to compare alternatives.

Last updated

laravel-weather

A Weather SDK For Laravel

安装

$ composer require oscarmx/laravel-weather -vvv

配置

本扩展需要使用高德开放平台,你可以自行注册账号,然后创建应用,获取API Key。申请地址: https://lbs.amap.com/dev/id/newuser

使用

use Oscarmx\LaravelWeather\Weather;

$key = '你的高德开放平台API Key';

$weather = new Weather($key);

##获取实时天气
$response = $weather->getWeather('深圳');

##获取近期天气预报
$response = $weather->getWeather('深圳', 'all');

##第三个参数为返回值类型,可选 json 与 xml,默认 json
$response = $weather->getWeather('深圳', 'all', 'xml');

Tips

目前代码为1.0版本,有问题可以给我提Issues https://github.com/oscar-mx/laravel-weather/issues

License

LICENSE

Star History Chart