isesame / weather
A weather SDK
0.0.1
2020-01-08 16:21 UTC
Requires
- guzzlehttp/guzzle: ^6.5
- mockery/mockery: ^1.3
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-04-09 05:47:01 UTC
README
A weather SDK.
Installing
$ composer require isesame/weather -vvv
Usage
- 在配置本拓展前,请先前往高德地图开放平台官网注册账号并创建应用,获取到应用的
ak
值 - 使用方法
$key = 'bb5e3bd493d1f29f52f9d8ee4bf47049'; $w = new \Isesame\Weather\Weather($key); $w->getLiveWeather('深圳'); $w->getForecastsWeather('深圳','xml');
- 在laravel中已经注册为服务,需要在config/services.php中配置
并在env中添加对应的高德应用key,即可使用... 'weather' => [ 'key' => env('WEATHER_API_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:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- 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