Skip to content

jeppos/skanetrafiken-php-api-client

Repository files navigation

skanetrafiken-php-api-client

A simple Skånetrafiken PHP API client.

Codacy Badge Build Status Codacy Badge

Installation

Composer

composer require jeppos/skanetrafiken-php-api-client

Usage

Following example shows how to get upcoming departures from Malmö C.

use Jeppos\SkanetrafikenApiClient\SerializerFactory;
use Jeppos\SkanetrafikenApiClient\Service\DepartureBoard;

$guzzleClient = new \GuzzleHttp\Client([
    'base_uri' => 'http://www.labs.skanetrafiken.se/v2.2/' // Version 2.2 of Skånetrafiken API
]);

$departureBoard = new DepartureBoard($guzzleClient, SerializerFactory::create());
$departureBoard->setStopAreaId(80000); // 80000 = Malmö C
$departureBoard->call();

$response = $departureBoard->getResponse();