PHP code example of lyrixx / ratp

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

    

lyrixx / ratp example snippets



$api = new Lyrixx\Ratp\Api();

$stop = array(
    array('line' => '138', 'stop' => 'General Leclerc-Victor Hugo', 'type' => $api::TYPE_BUS),
);

$stops = $api->getStops($stop);

$stops[0]->getName(); // 'General Leclerc-Victor Hugo'
$stops[0]->getLine(); // '138'
$stops[0]->getType(); // 'metro'

$direction = $stops[0]->getDirection('Ermont-Eaubonne RER.');
foreach($direction->getSchedule() as $time) {
    echo $time; // '11 mn';
}