traewelling / db-rest-mappings
This package provides a simple data structure for the REST responses of https://v5.db.transport.rest/.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/traewelling/db-rest-mappings
Requires
- php: ^8.0
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^11.5
This package is auto-updated.
Last update: 2025-10-08 17:07:22 UTC
README
This package is a very simple implementation of the datatypes used in https://v5.db.transport.rest/ and the corresponding API.
Warning
This is in very early development. Code might change without notice in the same version. Use at your own risk.
Usage
// get your departure board $responseJson = $client->get('/stops/8000191/departures', $query); $data = json_decode($responseJson, true); // parse into a DepartureBoard $hydrator = new \DRM\Hydrator\DbRestHydrator(); foreach ($data as $key => $value) { $data[$key] = $hydrator->hydrate($value, \DRM\Dto\Departure::class); }