This Widget was based on the HG Weather API, to generate your access key and check the query parameters, see the API documentation
The preferred way to install this extension is through composer.
Either run
$ composer require dynamikaweb/yii2-hgbrasil-weather "*"
or add
"dynamikaweb/yii2-hgbrasil-weather": "*"
to the require
section of your composer.json
file.
This project is under BSD-3-Clause license.
Add it to your components
'components' => [
...
'weather' => [
'class' => \dynamikaweb\weather\components\WeatherApi::className(),
'key' => 'Your key, you can get it from HG Brasil',
'parameters' => [
'city_name' => 'Canoas,RS',
]
],
...
]
for different parameters, see API documentation
create widget
use dynamikaweb\weather\Weather;
...
echo Weather::widget([
'days' = 2,
'icons' = Weather::ICONS_DEFAULT,
]);