PHP class to access the NS (Dutch Railways) API to access train planning, departures, stations and pricing.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a PHP API for accessing the NS (Dutch Railways) API / WebService. Details for this service and signing up (account is required, rate limited to 50,000 requests per service, per day) are documented here.

Currently supported is:

  • List of train stations
  • Live departures
  • List of disruptions
  • Trip planning and fares

Basic usage example

require ('ns_api.class.php');
$ns = new NsApi(API_ACCOUNT, API_KEY);
$ns->getStations('code', true);