Search by

omnitravel / navitia

GlitchArt

Omnitravel's Navitia, under any PHP host: a stop area's or a stop point's next departures and arrivals in real time, journeys from A to B, the stops near a point or by name, the lines of a coverage and their stops, its networks - from navitia.io or SNCF's api.sncf.com (the same API), with the key gi

1.x-dev 2026-11-09 23:31 UTC

This package is auto-updated.

Last update: 2026-11-10 00:35:32 UTC


README

omnisense/omnitravel's Navitia, under any PHP host: the Navitia v1 API on one coverage - navitia.io's (fr-idf, fr-ne...) or SNCF's (sncf at https://api.sncf.com/v1, the same API).

  • a stop's departures and arrivals (stop_areas/{id}/departures, stop_points/{id}/arrivals): the scheduled and the real-time time, the platform, the train's number, the line and its colours;
  • journeys from A to B (journeys): walks, rides with their stops and path, transfers;
  • the network: a stop area, the stop areas near a point (coords/{lon};{lat}/places_nearby) and by name (places), the coverage's lines page by page, a line's or a route's stop areas, the lines of a stop area, the networks as operators.
use Omnitravel\Model\DepartureQuery;
use Omnitravel\Navitia\NavitiaFactory;

$sncf = (new NavitiaFactory($httpClient))->create([
    'token' => getenv('SNCF_API_TOKEN'),          // by reference: never written in a file
    'coverage' => 'sncf',
    'base_uri' => 'https://api.sncf.com/v1',
    'attribution' => 'Données SNCF',
]);
foreach ($sncf->departures(new DepartureQuery('stop_area:SNCF:87391003', limit: 5)) as $departure) {
    echo $departure->number, ' ', $departure->headsign, ' ', $departure->time()->format('H:i'), ' voie ', $departure->platform, "\n";
}

Options: token and coverage (required), base_uri (https://api.navitia.io/v1), timezone (Europe/Paris), attribution, timeout; policy, usage (the family's).

Usage policy

policy.json declares what is known: a key, the credit to navitia.io (the attribution option's text when given). Its rate limits and rights are unknown: navitia.io's terms page (https://navitia.io/en/?p=1571) could not be read on 2026-11-10 (HTTP 403) and api.sncf.com publishes no quota, so nothing is enforced but what a site sets itself - its plan's quota, as 'policy' => ['rateLimits' => [['max' => 5000, 'window' => 'month']]]. A 429 and its Retry-After are honoured all the same.

The manual: docs/index.md. MIT.