1. Go to this page and download the library: Download batistackapp/weather-widget library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
batistackapp / weather-widget example snippets
use Arshaviras\WeatherWidget\Widgets\WeatherWidget;
use Filament\Panel;
public function panel(Panel $panel): Panel
{
return $panel
// ... other configuration
->widgets([
//...
WeatherWidget::class,
])
}
return [
/**
* API Key for Current Weather Data
* You can get your API key from OpenWeatherMap:
* https://openweathermap.org/price
*/
'api_key' => env('OPENWEATHER_API_KEY', ''),
/**
* Default city for weather data
*/
'city' => 'Yerevan',
/**
* Units for temperature and other measurements
* Options: 'metric', 'imperial'
* 'metric' - Celsius (°C), 'imperial' - Fahrenheit (°F)
* Default is 'metric'
*/
'units' => 'metric',
/**
* Refresh (Poll) interval in minutes
* This determines how often the weather data will be refreshed.
* This also factors into the cache duration.
*/
'refresh_minutes' => 30,
/**
* Icon settings
* You can customize the icon set and variant used in the widget.
* 'icon_set' can be 'fill', 'line', or 'monochrome'.
*/
'icon_set' => 'fill',
/**
* Icon variant
* Options: 'static', 'animated' (only for fill/line icons)
*/
'icon_variant' => 'animated',
];