PHP code example of harmonicdigital / ldbws

1. Go to this page and download the library: Download harmonicdigital/ldbws 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/ */

    

harmonicdigital / ldbws example snippets




use HarmonicDigital\Ldbws\LdbwsClient;
use HarmonicDigital\Ldbws\Response\FilterType;

$client = new LdbwsClient(apiKey: 'YOUR_API_KEY');

// Get the next 5 departures from London Euston (EUS) heading to Watford Junction (WFJ)
$board = $client->getDepartureBoard(
    'EUS',            // CRS code for the station
    5,            // up to 150
    'WFJ',      // optional filter station CRS
    FilterType::TO, // or FilterType::From
    0,         // minutes before/after current time (-120 to 120)
    60,        // window of results in minutes (0 to 120)
);

// $board is an instance of HarmonicDigital\Ldbws\Response\StationBoard
// Iterate services, times, destinations, etc.



use HarmonicDigital\Ldbws\LdbwsClient;
use HarmonicDigital\Ldbws\Response\FilterType;

$client = new LdbwsClient(apiKey: 'YOUR_API_KEY');

$boardWithDetails = $client->getDepartureBoardWithDetails('EUS');

// $boardWithDetails is an instance of HarmonicDigital\Ldbws\Response\StationBoardWithDetails
// It