rugaard/pollen

Fetch latest Pollen measurements from Astma-Allergi Denmark.

1.0.3 2020-11-14 18:26 UTC

This package is auto-updated.

Last update: 2024-04-15 01:50:00 UTC


README

68747470733a2f2f727567616172642e6769746875622e696f2f7061636b616765732f706f6c6c656e2f6c6f676f2e6a7067

🇩🇰🤧 Pollen measurements from Astma-Allergi Denmark

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f727567616172642f706f6c6c656e2e737667 68747470733a2f2f7472617669732d63692e6f72672f727567616172642f706f6c6c656e2e7376673f6272616e63683d6d6173746572 68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f636f7665726167652f727567616172642f706f6c6c656e2e737667 68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f727567616172642f706f6c6c656e2e737667 68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76312e7376673f6c6162656c436f6c6f723d356635663566266c6162656c3d6c6963656e736526636f6c6f723d343338393761266d6573736167653d434325323042592d4e432d4e44

Astma-Allergi Denmark does unfortunately not offer an official API for the latest pollen measurements in Denmark.

This package is (in some form) a workaround for that. It collects the latest measurements from the official Astma-Allergi Denmark website and turns it into structured data objects.

The returned data shows the measured pollen between 13:00 (1:00 PM) yesterday and 13:00 (1:00 PM) present day. Everyday at 16:00 (4:00 PM) the latest measurements are being published.

⚠️ Disclaimer

Since Astma-Allergi Denmark is an independent union, with a very little government funding, this package is made available under a very strict license, which prohibits any use other than personal.

If you wish to use the pollen measurements commercially, you should contact Astma-Allergi Denmark directly and support them by buying the data instead. The payment goes directly to the maintenance and further development of their Pollen measurement service.

For more info about a commercial license, visit their official website.

📖 Table of contents

📦 Installation

You can install the package via Composer, by using the following command:

composer require rugaard/pollen

Laravel

This package comes with a out-of-the-box Service Provider for the Laravel framework. If you're using a newer version of Laravel (>= 5.5) then the service provider will be loaded automatically.

Are you using an older version, then you need to manually add the service provider to the config/app.php file:

'providers' => [
    Rugaard\Pollen\Providers\Laravel\ServiceProvider::class,
]

⚙️ Usage

First thing you need to do, is to instantiate the Pollen client

# Instantiate the Pollen client.
$pollen = new \Rugaard\Pollen\Pollen;

Once you've done that, you're able to request the latest measurements from one of the supported pollen stations:

# Copenhagen pollen station.
$measurements = $pollen->get('copenhagen');

Pollen client

The Pollen client which handles the requests to Astma-Allergi Denmark.

new Pollen(?Client $httpClient);
Parameter Type Default Description
$httpClient \GuzzleHttp\ClientInterface null Replace the default underlying HTTP Client

Methods

Get measurements.

Get latest pollen measurements from a specific pollen station.

get(string $stationCode);
Parameter Type Description
$stationCode string Code of station. Supported pollen stations.

Note: The returned data shows the measured pollen between 13:00 (1:00 PM) yesterday and 13:00 (1:00 PM) present day. The measurements are updated everyday at 16:00 (4:00 PM).

🏛 Pollen stations

Currently there only exists two Pollen stations in Denmark.

ID Name Code Region
48 København copenhagen East
49 Viborg viborg West

🗣 Frequently Asked Questions (FAQ)

What is this Tightenco\Collect\Support\Collection class and how does it work?

All data is returned within a Tightenco\Collect\Support\Collection class. The class is a port of the popular Collection class from Laravel.

Please refer to Laravel's detailed documentation, to learn more about how you work with a Collection:
https://laravel.com/docs/master/collections

💰 Donating to Astma-Allergi Denmark

To help Astma-Allergi Denmark maintain and further develop the Pollen measurement service.
Please consider sending them a donation.

🚓 License

This package is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 (CC BY-NC-ND 4.0).

Creative Commons License