Пример #1
0
 /**
  * @param Client $client
  */
 public function __construct(Client $client)
 {
     $this->client = $client;
     $this->options = array('query' => array('lang' => $this->client->getLocale(), 'format' => $this->client->getFormat()));
     parent::__construct(array('base_url' => $this->client->getUrl()));
 }
Пример #2
0
<?php

require_once '../vendor/autoload.php';
/**
 * Create a new instance of the iRail Client.
 *
 * You can pass an array with your prefered language like this
 *
 * new iRail(array('lang' => 'nl'));
 */
use iRail\Client as iRail;
$irail = new iRail();
/**
 * To get a list of all the stations:
 */
$stations = $irail->api('station')->all();
/**
 * To get info about a connection:
 *
 * You can add a bunch off different parameters by passing an array as the 3rd parameter. The following parameters are allowed:
 *
 * date: dmy (day of month with leading 0, number of the month with leading 0, 10 or 11 (for 2010 or 2011))
 * time: Hours in 24 hour format concatenated with minutes with leading 0!
 * timeSel: Whether the date & time are for arrival or depart. Should be "arrive" or "depart"
 * typeOfTransport: Semicolon separated list of supported transportations. (eg: train;bus;taxi)
 */
$connection = $irail->api('connection')->schedule('Tienen', 'Courtrai');
/**
 * You can easily get a list of all trains leaving from a city by using the live board. The following example will return a list of all trains departing in Tienen on February 2, 2014 at 1PM.
 *
 * If you prefer working with id's, you can use the id() function. It works the same way, only with an id.