PHP code example of jeppos / skanetrafiken-php-api-client

1. Go to this page and download the library: Download jeppos/skanetrafiken-php-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeppos / skanetrafiken-php-api-client example snippets


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();

composer