This library is written in PHP and is using guzzle for requesting the EFA API. An API to request informations about public transport in a city. Used in cities in Germany like Augsburg, Munich or Münster.
Use composer
composer require gared/efa-php-client
Initialize Client with base url for the EFA API.
$client = new \Gared\EFA\Client(\Gared\EFA\Client::BASE_URL_MVV);
Transport association | constant |
---|---|
Münchner Verkehrs Verbund | BASE_URL_MVV |
Augsburger Verkehrs Verbund | BASE_URL_AVV |
Verkehrsverbund Rhein-Ruhr | BASE_URL_VRR |
Großraum-Verkehr Hannover | BASE_URL_GVH |
Braunschweiger Verkehrs-GmbH | BASE_URL_BSVG |
$stationService = $client->findStations('Hauptbahnhof');
$response = $stationService->getStations();
foreach ($response->getStopFinder()->getPoints() as $point) {
if ($point->getAnyType() === 'stop') {
echo $point->getName() . ': ' . $point->getRef()->getLatitude() . ' ' . $point->getRef()->getLongitude() . PHP_EOL;
}
}
- You need at least PHP 7.4
This library using the following endpoints:
Endpoint | Method name | Description |
---|---|---|
XML_STOPFINDER_REQUEST | $client->findStations | Get stations and POIs |
XML_TRIP_REQUEST2 | $client->findTrip | Get (realtime) informations about transportation possibilities from one place to another |
XML_DM_REQUEST | $client->findDepartures | Get departure informations of a station |
XML_SYSTEMINFO_REQUEST | $client->getSystem | Get system info and version |
XML_ADDINFO_REQUEST | TODO | Get additional informations like interferences |
Read more about this API here: