jonlynch/laravel-dashboard-uk-weather-tile

A package to add UK Met Office weather forecast tiles to Laravel Dashboard

v1.2 2024-04-04 13:56 UTC

This package is auto-updated.

Last update: 2024-09-04 15:18:15 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A weather forecast tile powered by Met Office data.

This tile can be used on the Laravel Dashboard.

Installation

You can install the package via composer:

$ composer require jonlynch/laravel-dashboard-uk-weather-tile

Usage

In your dashboard view you use the livewire:uk-weather-tile component. You may add more than one weather forecast by adding more locations.

<x-dashboard>
    <livewire:uk-weather-tile position="a1:a2" location-name="St Bees"/>
    <livewire:uk-weather-tile position="b1:b2" location-name="Scafell Pike"/>
</x-dashboard>

Add the config to the tiles sections of your config/dashboard.php

// in config/dashboard.php

return [
    // ...
    tiles => [
        'ukweather' => [
            'apikey' => env('MET_OFFICE_API_KEY'),
            'locations' => [
                'St Bees' => [
                    'lat' => '54.4891',
                    'lon' => '-3.6080',
                ],
                'Scafell Pike' => [
                    'lat' => '54.4543',
                    'lon' => '-3.2115'
                ]
            ],
            'refresh_interval_in_seconds' => 600,
        ]
    ]

In app\Console\Kernel.php you should schedule the JonLynch\UkWeatherTile\Commands\FetchMetOfficeDataCommand to run every 30 minutes.

// in app\Console\Kernel.php

protected function schedule(Schedule $schedule)
{
    $schedule->command(\JonLynch\UkWeatherTile\Commands\FetchMetOfficeDataCommand::class)->everyThirtyMinutes();

}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.