Skip to content

Gared/efa-php-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP client library for EFA API

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.

Installation

Use composer

composer require gared/efa-php-client

Usage examples

Configure 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

Find stations

$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;
    }
}

Supported Platforms

  • You need at least PHP 7.4

Documentation

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:

About

PHP client for requesting EFA API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages