snowmannunu / weather
A weather SDK.
1.0.3
2023-07-04 02:13 UTC
Requires
- guzzlehttp/guzzle: ^7.7
Requires (Dev)
- mockery/mockery: ^1.5
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2025-07-18 12:44:39 UTC
README
A weather SDK
Installing
$ composer require snowmannunu/weather -vvv
Config
在使用本扩展之前,你需要去 高德开放平台 注册账号,然后创建应用,获取应用的 API Key。
Usage
use SnowmanNunu\Weather\Weather; $key = 'your key'; $weather = new Weather($key);
获取实时天气
$response = $weather->getLiveWeather('深圳');
获取近期天气预报
$response = $weather->getForecastsWeather('深圳');
Used in Laravel
在 Laravel 中使用也是同样的安装方式,配置写在 config/services.php 中:
'weather' => [ 'key' => env('WEATHER_API_KEY'), ],
在 .env 中配置 WEATHER_API_KEY :
WEATHER_API_KEY=your key
TODO
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