isesame/weather

0.0.1 2020-01-08 16:21 UTC

This package is auto-updated.

Last update: 2024-05-09 03:44:43 UTC


README

A weather SDK.

Build Status

Installing

$ composer require isesame/weather -vvv

Usage

  1. 在配置本拓展前,请先前往高德地图开放平台官网注册账号并创建应用,获取到应用的ak
  2. 使用方法
    $key = 'bb5e3bd493d1f29f52f9d8ee4bf47049';
    $w = new \Isesame\Weather\Weather($key);
    
    $w->getLiveWeather('深圳');
    $w->getForecastsWeather('深圳','xml');
  3. 在laravel中已经注册为服务,需要在config/services.php中配置
    ...
    
    'weather' => [
        'key' => env('WEATHER_API_KEY'),
    ],
    
    ...
    
    并在env中添加对应的高德应用key,即可使用
    app('weather')->getLiveWeather('深圳');
     
    或
    
    public function show(Request $request, Weather $weather, $city)
    {
        return $weather->getWeather($city);
    } 

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT