pgrimaud/sytadin

Real time information about road traffic in Paris

2.0.3 2021-09-02 17:32 UTC

This package is auto-updated.

Last update: 2024-11-29 04:41:25 UTC


README

Packagist Build Status

Real time information about road traffic on the Paris beltway.

Usage

composer require pgrimaud/sytadin
$api = new \Sytadin\Api();

$parameters = [
    'start' => 'orleans',
    'end' => 'bercy',
    'direction' => $api::DIRECTION_EXTERIOR
];

$api->setParameters($parameters);
$route = $api->getRoute();

echo $route->getStart()->getName() . PHP_EOL;
//orleans

echo $route->getEnd()->getName() . PHP_EOL;
//bercy

foreach ($route->getSections() as $section) {
    echo $section->getStart()->getName() . '->' . $section->getEnd()->getName() . PHP_EOL;
    echo $section->getTime() . ' (ref :' . $section->getTimeReference() . ')' . PHP_EOL;
}
//orleans->italie
//8 (ref :4)
//italie->bercy
//4 (ref :2)

//reference time
echo $route->getTimeReference() . PHP_EOL;
//6

//real time
echo $route->getTime() . PHP_EOL;
//12

//kilometers
echo $route->getKms() . PHP_EOL;
//8

If Time is superior to the TimeReference, it means there is some traffic jams.

Gates available

foreach (\Sytadin\Gate::listGates() as $gate) {
    echo $gate . PHP_EOL;
}
chapelle
maillot
auteuil
orleans
italie
bercy
bagnolet

Copyright

No copyright, based & crawled on Sytadin website (http://www.sytadin.fr)