baspa / filament-buienradar-widget
Widget to show the Dutch forecast in a Filament widget
Fund package maintenance!
Baspa
Requires
- php: ^8.1
- baspa/buienradar-php-api: ^1.0
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
This package is auto-updated.
Last update: 2024-11-27 08:14:18 UTC
README
This package provides a Filament widget to show the Dutch forecast from Buienradar. The package is based on the Buienradar PHP package.
Installation
You can install the package via composer:
composer require baspa/filament-buienradar-widget
You can publish the config file with:
php artisan vendor:publish --tag="buienradar-widget-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="buienradar-widget-views"
This is the contents of the published config file:
return [ 'station' => MeasuringStation::VOLKEL, 'show' => [ 'temperature' => true, 'weather_description' => true, 'wind_speed' => true, 'stationname' => true, 'humidity' => true, 'last_update' => true, ], ];
To check what stations are available, you can check the MeasuringStation
enum in the Buienradar package.
Usage
Add the widget to your Filament page via your provider:
use Baspa\FilamentBuienradarWidget\Widgets\FilamentBuienradarWidgetPlugin; // ... ->plugin(FilamentBuienradarWidgetPlugin::make())
And optionally add the widgets to your page:
use Baspa\FilamentBuienradarWidget\Widgets\ForecastReportWidget; use Baspa\FilamentBuienradarWidget\Widgets\ForecastLongTermWidget; use Baspa\FilamentBuienradarWidget\Widgets\ForecastShortTermWidget; use Baspa\FilamentBuienradarWidget\Widgets\ForecastForStationWidget; // ... public function getHeaderWidgetsColumns(): int { return 12; } public function getHeaderWidgets(): array { return [ ForecastForStationWidget::make([ 'width' => 4, // Define the width of the widget ]), ForecastShortTermWidget::make([ 'width' => 4, ]), ForecastLongTermWidget::make([ 'width' => 4, ]), ForecastReportWidget::make([ 'width' => 12, ]), ]; }
Forecast for station
Set the station per widget
To set the station per widget, you can pass the station in the widget. This will override the station set in the config.
use Baspa\Buienradar\Enum\MeasuringStation; // ... ForecastForStationWidget::make([ 'station' => MeasuringStation::VOLKEL, ])
Forecast report
Forecast short term
Forecast long term
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.