PHP code example of miklcct / nwst-mobile-api

1. Go to this page and download the library: Download miklcct/nwst-mobile-api 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/ */

    

miklcct / nwst-mobile-api example snippets


use Miklcct\Nwst\ApiFactory;
use GuzzleHttp\Client;
$api = (new ApiFactory(new Client()))();

use Miklcct\Nwst\Model\Eta;
use Miklcct\Nwst\Model\NoEta;
use Miklcct\Nwst\Model\Rdv;
use Miklcct\Nwst\Model\Route;
use Miklcct\Nwst\Model\RouteStop;
use Miklcct\Nwst\Model\StopInfo;
use Miklcct\Nwst\Model\Variant;
use Miklcct\Nwst\Model\VariantInfo;

/** @var Route[] $routes */
$routes = $api->getRouteList()->wait();
/** @var Variant[] $variants */
$variants = $api->getVariantList('970--So_Uk')->wait();
/** @var RouteStop[] $stops */
$stops = $api->getStopList(
    new VariantInfo(
        Route::COMPANY_NWFB
        , Rdv::parse('970-SOU-1')
        , 1
        , 40
        , 10632
        , Route::INBOUND
    )
)->wait();
/** @var StopInfo $stop_info */
$stop_info = $api->getRouteInStopList(1554)->wait();
/** @var Eta[]|NoEta $etas */
$etas = $api->getEtaList('970', 32, 1554, Rdv::parse('970-SOU-1'), 'O')->wait();