b3none/emtapi

There is no license information available for the latest version (v2.0.0) of this package.

East Midlands Trains PHP API Client

v2.0.0 2018-03-21 15:34 UTC

This package is auto-updated.

Last update: 2024-04-05 00:04:47 UTC


README

East Midlands Trains API Client written in PHP.

Author

B3none - Developer / Maintainer

Composer

composer require b3none/emtapi

Example use

$emtapi = \B3none\emtapi\EMTClient::create();
$emtapi->createStationsFile();
$emtapi->getJourneys(\B3none\emtapi\Station::DERBY, \B3none\emtapi\Station::NOTTINGHAM);

Example response

[
    'trains' => [
        0 => [
            'locationname' => 'Nottingham',
            'st' => '16:40',
            'et' => 'On time',
            'cssclass' => null,
            'operator' => 'CrossCountry',
            'trainid' => '+eRxw6w7A8UJsGRGIAT5Ag==',
            'platform' => '6A',
            'selecteddets_sta' => '16:34',
            'selecteddets_location' => 'Derby',
            'selecteddets_length' => '23 minutes',
            'selecteddets_prevlength' => '2 hours, 55 minutes',
            'callingpoints' => [
                '0' => [
                    'locationname' => 'Long Eaton',
                    'st' => '16:34',
                    'et' => 'On time',
                    'cssclass' => null
                ]
            ],
            'previouscallingpoints' => [
                0 => [
                    'locationname' => 'Cardiff Central',
                    'st' => '13:45',
                    'et' => null,
                    'cssclass' => 'circle-full',
                    'at' => 'On time'
                ]
            ]
        ]
    ]
]

Testing

To run all of the unit tests run

vendor/bin/phpunit tests