fadhriza / indonesia-weather-widget
Filament widget for displaying real-time weather information from BMKG (Badan Meteorologi, Klimatologi, dan Geofisika) API
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
pkg:composer/fadhriza/indonesia-weather-widget
Requires
- php: ^8.2
- filament/filament: ^4.0
- filament/widgets: ^4.0
- laravel/framework: ^10.0|^11.0|^12.0
- spatie/laravel-package-tools: ^2.0
Requires (Dev)
- fakerphp/faker: ^1.23
- laravel/pint: ^1.24
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.6
- phpunit/phpunit: ^11.5.3
This package is auto-updated.
Last update: 2025-12-22 22:45:21 UTC
README
A Filament plugin that displays real-time weather information from BMKG (Badan Meteorologi, Klimatologi, dan Geofisika) API as a dashboard widget.
Features
- 🌤️ Real-time weather data from BMKG API
- 📊 Displays temperature, humidity, wind speed, cloud cover, and more
- 🔄 Refresh button to update weather data
- 🎨 Beautiful, responsive UI using Filament components
- 🌍 Configurable region code for different locations in Indonesia
Installation
Install the package via Composer:
composer require fadhriza/indonesia-weather-widget
The service provider will be automatically registered via Laravel's package discovery.
Usage
Register the Widget in Your Panel
To use the widget in your Filament panel, you need to register it in your panel provider. If you don't have a panel provider yet, create one:
<?php namespace App\Providers; use Filament\Panel; use Filament\PanelProvider; use IndonesiaWeather\Widgets\IndonesiaWeatherWidget; class YourPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel ->id('admin') ->path('admin') ->widgets([ IndonesiaWeatherWidget::class, ]); } }
Configure Region Code
The widget uses a default region code (31.71.03.1001 for Jakarta Pusat). You can customize the region code by modifying the widget instance or passing it when mounting:
// In your panel provider or widget configuration
IndonesiaWeatherWidget::class,
The widget accepts a regionCode property. You can find region codes from BMKG documentation.
Example Region Codes
- Jakarta Pusat:
31.71.03.1001 - Jakarta Selatan:
31.74.01.1001 - Bandung:
32.73.01.1001 - Surabaya:
35.78.01.1001
(Note: These are examples. Please refer to BMKG documentation for accurate region codes.)
Building Assets
After making changes to the JavaScript file, rebuild the assets:
npm run build:widget
Or build all assets:
npm run build
Project Structure
indonesia-weather-plugins/
├── src/
│ ├── IndonesiaWeatherServiceProvider.php # Plugin service provider
│ └── Widgets/
│ └── IndonesiaWeatherWidget.php # Widget class
├── resources/
│ ├── views/
│ │ └── widget.blade.php # Widget view
│ ├── lang/
│ │ └── en/
│ │ └── widget.php # Translations
│ ├── js/
│ │ └── indonesia-weather-widget.js # Alpine component
│ └── dist/
│ └── indonesia-weather-widget.js # Built JavaScript
└── composer.json # Composer configuration
API Information
This plugin uses the BMKG Public API:
- Endpoint:
https://api.bmkg.go.id/publik/prakiraan-cuaca?adm4={region_code} - Documentation: See
bmkg_weather_api_docs.txt
Weather Data Fields
The widget displays the following information:
- Temperature (t): Air temperature in °C
- Humidity (hu): Air humidity in %
- Weather Condition (weather_desc): Weather description in Indonesian
- Wind Speed (ws): Wind speed in km/h
- Wind Direction (wd): Wind direction
- Cloud Cover (tcc): Cloud coverage in %
- Visibility (vs_text): Visibility distance in km
- Local Time (local_datetime): Local time
- UTC Time (utc_datetime): UTC time
Development
Requirements
- PHP ^8.2
- Laravel ^12.0
- Filament ^4.0
- Node.js (for building assets)
Development Commands
# Install dependencies composer install npm install # Build widget assets npm run build:widget # Clear caches php artisan cache:clear php artisan config:clear php artisan view:clear
License
This plugin is open-sourced software licensed under the MIT license.