定制 fadhriza/indonesia-weather-widget 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fadhriza/indonesia-weather-widget

最新稳定版本:v1.0.1

Composer 安装命令:

composer require fadhriza/indonesia-weather-widget

包简介

Filament widget for displaying real-time weather information from BMKG (Badan Meteorologi, Klimatologi, dan Geofisika) API

README 文档

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.

Credits

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固