PHPackages                             fwidm/dwd-hourly-crawler - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fwidm/dwd-hourly-crawler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fwidm/dwd-hourly-crawler
========================

Crawls the DWD FTP to retrieve weather data from German weather Stations

328PHP

Since Feb 2Pushed 8y ago2 watchersCompare

[ Source](https://github.com/FWidm/dwd-hourly-crawler)[ Packagist](https://packagist.org/packages/fwidm/dwd-hourly-crawler)[ RSS](/packages/fwidm-dwd-hourly-crawler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

DWD-Crawler
===========

[](#dwd-crawler)

This package contains methods to query the DWD FTP by specifying the parameters you want to query, as well as a date and latitude + longitude.

Data Source
-----------

[](#data-source)

All data is retrieved from the public data set made available by the German Meteorological Service (DWD).

Root of the public CDC FTP: `ftp://ftp-cdc.dwd.de/pub/CDC/`.

[![](doc/img/dwd_logo_258x69.png)](doc/img/dwd_logo_258x69.png)

Explanation
-----------

[](#explanation)

The current implementaton revieces a request with the needed variables, the user's location at a specific point in time. Afterwards the DWDLib objects initializes the requested variable's services that contain all the paths and the method to parse the data into a corresponding class that extends `DWDAbstractParameter`. Afterwards the Crawler combines the data for all requested variables and returns them as an array to the callee. [![](doc/img/description.png)](doc/img/description.png)

Features
--------

[](#features)

- Queries recent hourly data on the public DWD FTP for all of Germany
    - Available params
- Contains a safe query option that queries several nearest stations to get one result
- Parses the Output into different Objects that contain all of the data the file contains plus the short description for all the parameters.

Fixed
-----

[](#fixed)

- Change the config from using OS dependant slashes on Ftp paths - currently the script fails on win due to backslashes in the FTP Path.
    - Only local file use the OS dependant slashes.
- Allow the user to modify the baseDirectory of the output via the constructor flag.
    - Can be done by specifying a param when creating the DWDLib instance.
- Allow the user to split queried variables from the predefined groups by the dwd to single variables.
- Add distance from station to the queried point
- Added Fractal support
- Added experimental support to find data faster

Todo
----

[](#todo)

- Cache nearest station for one crawler task (can't be done as of now, as each variable may have other active controllers.)
- Change code: check if query date is older or equal than last checked, else do not query
- If older data is queried maybe disable the check if a station is active this is extremely important for Solar stuff
    - maybe rewrite the "active" part in a way that checks if the queried date is inside the "active" period of stations
- Add option to enable logging via the constructor
- Add option to set the radius of active stations near the given point.

Example
-------

[](#example)

Usage of the library is quite simple:

```
//Coordinates we want to query
$coordinates=new Coordinate(48.3751,8.9801);
//Use default folders
$dwdLib=new DWDLib();

//OR: set output of the downloaded files to /storage/...
$dwdLib = new DWDLib("storage");

//set up which parameters you need
$param = new DWDHourlyParameters();
$param->addAirTemperature()->addCloudiness()->addPrecipitation()->addPressure()->addSoilTemperature()->addSun()->addWind()/*->add...*/;
// EITHER:
$out = $dwdLib->getHourlyByInterval($param, $date, $coordinates->getLat(), $coordinates->getLng());
// OR: to get all data for one day
$out = $dwdLib->getHourlyDataByDay($vars, $date, $coordinates->getLat(), $coordinates->getLng());
```

out consists of an array with the key ` values` =&gt; weather params and `stations` =&gt; weather stations.

### DWD Parameter "Groups"

[](#dwd-parameter-groups)

Get Parameter JSON:

```
/*
 * Print all retrieved items in the 'values' part => weather parameters as json
 */
foreach ($out['values'] as $key => $obj) {
    print "obj=$key";
    //either iterate to convert single items
    foreach ($obj as $value) {
        /* @var $value DWDAbstractParameter */
        //Each model has a toResource method that returns Fractal's ResourceAbstract, it can be used to retrieve an array or json data
        prettyPrint(FractalWrapper::toJson(FractalWrapper::toResource($parameter,new ParameterTransformer()),JSON_PRETTY_PRINT));
    //or use fractal wrapper if you want to convert everything
    $collection=FractalWrapper::toResource($obj,new ParameterTransformer());
    prettyPrint(FractalWrapper::toJson($collection,JSON_PRETTY_PRINT));
    }
}
```

Output:

```
{
    "data": {
        "station_id": 2074,
        "description": {
            "qualityLevel": "QN_9: quality level - refer to ftp:\/\/ftp-cdc.dwd.de\/pub\/CDC\/observations_germany\/climate\/hourly\/air_temperature\/recent\/DESCRIPTION_obsgermany_climate_hourly_tu_recent_en.pdf",
            "temperature2m": "TT_TU: temperature in 2m height - in degrees Celsius.",
            "relativeHumidity": "RF_TU: relative humidity in percent.",
            "temperature2mUnit": "C",
            "relativeHumidityUnit": "%"
        },
        "classification": "Temperature",
        "distance": 8.651701,
        "lon": "8.9801",
        "lat": "48.3751",
        "date": "2017-09-16T22:00:00+00:00",
        "2m_temperature": "6.5",
        "2m_temperature_unit": "C",
        "relative_humidity": "96.0",
        "relative_humidity_unit": "%"
    }
}
```

### Stations

[](#stations)

Get Station JSON:

```
/*
 * Print all stations as json
 */
foreach ($out['stations'] as $key => $obj) {
    print "obj=$key";
    /* @var $obj \FWidm\DWDHourlyCrawler\Model\DWDStation */
    prettyPrint(FractalWrapper::toJson(FractalWrapper::toResource($obj,new StationTransformer()),JSON_PRETTY_PRINT));

}
//or use fractal wrapper if you want to convert everything
$collection=FractalWrapper::toResource($out['stations'] ,new StationTransformer());
prettyPrint(FractalWrapper::toJson($collection,JSON_PRETTY_PRINT));
```

Output:

```
{
    "data": {
        "id": "02074",
        "from": "2004-06-01T09:27:45+00:00",
        "until": "2017-11-28T09:27:45+00:00",
        "name": "Hechingen",
        "state": "Baden-W\u00fcrttemberg",
        "height": "522",
        "lon": "8.9801",
        "lat": "48.3751",
        "active": true
    }
}
```

### Compact Parameters

[](#compact-parameters)

In addition, it is possible to transform these "grouped" parameters into single variable objects:

```
$collection=FractalWrapper::toResource($exported,new CompactParameterTransformer());
prettyPrint(FractalWrapper::toJson($collection,JSON_PRETTY_PRINT));
```

Output:

```
{
    "data": [
        {
            "station_id": 2074,
            "description": {
                "name": "TT_TU: temperature in 2m height - in degrees Celsius.",
                "quality": 3,
                "qualityType": "QN_9: quality level - refer to ftp:\/\/ftp-cdc.dwd.de\/pub\/CDC\/observations_germany\/climate\/hourly\/air_temperature\/recent\/DESCRIPTION_obsgermany_climate_hourly_tu_recent_en.pdf",
                "units": "C"
            },
            "classification": "Temperature",
            "distance": 8.651701,
            "lon": "8.9801",
            "lat": "48.3751",
            "date": "2017-09-16T22:00:00+02:00",
            "value": 6.5,
            "type": "2 metre temperature"
        },
        {
            "station_id": 2074,
            "description": {
                "name": "RF_TU: relative humidity in percent.",
                "quality": 3,
                "qualityType": "QN_9: quality level - refer to ftp:\/\/ftp-cdc.dwd.de\/pub\/CDC\/observations_germany\/climate\/hourly\/air_temperature\/recent\/DESCRIPTION_obsgermany_climate_hourly_tu_recent_en.pdf",
                "units": "%"
            },
            "classification": "Temperature",
            "distance": 8.651701,
            "lon": "8.9801",
            "lat": "48.3751",
            "date": "2017-09-16T22:00:00+02:00",
            "value": 96,
            "type": "relative humidity in percent"
        }
    ]
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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 (5 commits)")

---

Tags

composer-packagedwddwd-ftpphp-libraryphp7weather-dataweather-library

### Embed Badge

![Health badge](/badges/fwidm-dwd-hourly-crawler/health.svg)

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

###  Alternatives

[lisachenko/z-engine

Library that provides direct access to native PHP structures

45423.0k3](/packages/lisachenko-z-engine)[geoffreyrose/us-holidays

US Holidays Wrapper for the Carbon DateTime Library.

62717.0k2](/packages/geoffreyrose-us-holidays)[unleash/symfony-client-bundle

38443.5k](/packages/unleash-symfony-client-bundle)[dillingham/soft-deletes-parent

Soft delete children when parent soft deletes

561.3k](/packages/dillingham-soft-deletes-parent)[elabx/fieldtype-recurring-dates

Field to setup recurring dates using RRule

104.2k](/packages/elabx-fieldtype-recurring-dates)

PHPackages © 2026

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