PHPackages                             fwidm/weatherdata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. fwidm/weatherdata

ActiveApiato-container[Database &amp; ORM](/categories/database)

fwidm/weatherdata
=================

Apiato Container that contains models for weather data storage.

11PHP

Since Mar 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/FWidm/apiato-weatherdata)[ Packagist](https://packagist.org/packages/fwidm/weatherdata)[ RSS](/packages/fwidm-weatherdata/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

WeatherData Container
=====================

[](#weatherdata-container)

Can be used to fetch weather data for specific `GeoLocations` which consists of latitude, longitude and a timestamp.

Unit conversion
---------------

[](#unit-conversion)

Unit conversion currently is a work in progress. Conversion will happen on the fly if you specify the `conversion=x` parameter in your query. If those are specified we will pass the fetched data from our main task to the converter task which will try to convert all data that match your request.

#### Syntax

[](#syntax)

- `?convert=`
    - ``: multiple conversions separated by `;` e.g. `?convert=*:C;*L` converts all applicable values to °C and Liters.
    - You can specify either all data points applicable by using `*` as a wildcard symbol or specify the parameters like this: `?convert=a,b,c:C`to convert all parameters whose names contain a, b or c into °C if possible.
    - Failed conversions are currently not
- Each weather data point will only be converted once! So if you specify `?convert=*:C,*:K` all values will be converted to °C

#### Supported Units

[](#supported-units)

Currently with the two sample gateways it is possible to gather data in the following units:

unitsupported`(0 - 1)``%``% (n/8 where -1 means error)``~``bool (0 no precipitation, 1 precipitation)``C`✔`deg``hPA`✔`integer (0-9)``K`✔`kg m**-2`✔`kg s**2 m**-5``m s**-1``m**2 s**-2``min`✔`mm`✔`Pa`✔Currently the the [Convertor Library](https://github.com/olifolkerd/convertor) by oli folkerd was [forked](https://github.com/FWidm/convertor/blob/master/src/Convertor.php) and adapted to the needs of this api.

Gateways
--------

[](#gateways)

Gateways are objects that are able to retrieve data from weather sources. Additionally they also transform the retrieved format into a common format:

### Adding another Gateway

[](#adding-another-gateway)

- To add another `*GateWay` your new Class has to extend `AbstractDataRetrievalGateway` and implement the following methods:
    - `retrieve()`: Internal function that describes how you fetch data. Either by calling another Service (i.e. `CopernicusRetrievalGateway`) or using a Library (i.e. `DWDRetrievalGateway`)
    - `parseToWeatherData()`: Parse the retrieved data to the expected format by calling the corresponding Transformer.
    - Optional: implement `parseToWeatherSource()`: if your service provides additional data that can be relevant for severl entries. The German Meteorological Service (DWD) uses measuring stations and provides informations about the stations when retrieving data. This information about the station is in return saved into a `WeatherSource` model.
- When everything is finished yor last step is to edit the `DataRetrievalJob`:
    - Register the new implemented gateway in the settings in `weather.php` like this: ```
        'gateways' => [
                          new DWDRetrievalGateway(),
                          new CopernicusRetrievalGateway(),
                          new YourRetrievalGateway()
                      ];

        ```

#### Example `*ToWeatherDataTransformer` output:

[](#example-toweatherdatatransformer-output)

```
Array
    (
    [data] => Array
    (
        [source_id] =>
        [source] => Copernicus
        [value] => 0.83590698242188
        [description] => stdClass Object
        (
            [dataTime] => 0
            [name] => High cloud cover
            [step] => 0
            [date] => 20170928
            [shortName] => hcc
            [paramId] => 188
            [index] => 45047
        )

        [classification] => Cloudiness
        [distance] => 13.558712398993
        [lat] => 48.29265233053
        [lon] => 9.5
        [date] => Carbon\Carbon Object
        (
            [date] => 2017-09-28 00:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )
        [type] => High cloud cover
        [geo_location_id] => 6
        [unit] => (0 - 1)
        )
    )

```

#### Example `* ToWeatherSourceTransformer` output

[](#example--toweathersourcetransformer-output)

Note that data is a `json`-column in your db and can contain a multitude of data.

```
Array
(
    [data] => Array
    (
        [original_id] => 03402
        [data] => FWidm\DWDHourlyCrawler\Model\DWDStation Object
            (
                [id:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => 03402
                [from:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => Carbon\Carbon Object
                    (
                        [date] => 2002-11-01 10:14:27.000000
                        [timezone_type] => 3
                        [timezone] => UTC
                    )

                [until:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => Carbon\Carbon Object
                    (
                        [date] => 2017-10-07 10:14:27.000000
                        [timezone_type] => 3
                        [timezone] => UTC
                    )

                [height:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => 750
                [latitude:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => 48.3851
                [longitude:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => 9.4837
                [name:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => Münsingen-Apfelstetten
                [state:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => Baden-Württemberg
                [active:FWidm\DWDHourlyCrawler\Model\DWDStation:private] => 1
            )

        [source] => DWD
    )
)

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/76cfbd6379ee184402779fe2b5c5ad7aaabdb2f6b755ca6c938daeb0546334b6?d=identicon)[fwidm](/maintainers/fwidm)

---

Top Contributors

[![FWidm](https://avatars.githubusercontent.com/u/3480240?v=4)](https://github.com/FWidm "FWidm (2 commits)")

### Embed Badge

![Health badge](/badges/fwidm-weatherdata/health.svg)

```
[![Health](https://phpackages.com/badges/fwidm-weatherdata/health.svg)](https://phpackages.com/packages/fwidm-weatherdata)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
