PHPackages                             irail/stations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. irail/stations

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

irail/stations
==============

Use the Belgian railway's station in your PHP project

2.0.14(1y ago)332.5k23[9 issues](https://github.com/iRail/stations/issues)[1 PRs](https://github.com/iRail/stations/pulls)CC0-1.0PHPPHP ^8.0

Since Aug 21Pushed 1mo ago13 watchersCompare

[ Source](https://github.com/iRail/stations)[ Packagist](https://packagist.org/packages/irail/stations)[ RSS](/packages/irail-stations/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (73)Used By (0)

All stations in Belgium
=======================

[](#all-stations-in-belgium)

[![Build Status](https://camo.githubusercontent.com/4d5fe61bdbe88cd9770f6e0cbf64fc7d845256ec9c795017843fec89734aa0fd/68747470733a2f2f7472617669732d63692e6f72672f695261696c2f73746174696f6e732e737667)](https://travis-ci.org/iRail/stations)[![Dependency Status](https://camo.githubusercontent.com/ece9e94bbc0c28834b75763f0dd19964a1be959f424531643a6731c49666d619/68747470733a2f2f64617669642d646d2e6f72672f695261696c2f73746174696f6e732e737667)](https://david-dm.org/iRail/stations)[![Software License](https://camo.githubusercontent.com/c6293a69e9c9c000bfdfeb0edfc33c41183eae125851e3cc25d25d6493ec930a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4343302d627269676874677265656e2e7376673f7374796c653d666c6174)](https://creativecommons.org/publicdomain/zero/1.0/)

We try to maintain a list of all the stations in Belgium using CSV so everyone can help to maintain it on github. Furthermore, we have a PHP composer/packagist library for you to go from station name to ID and vice versa and we convert the CSV file to JSON-LD for maximum semantic interoperability.

Fields we collect
-----------------

[](#fields-we-collect)

### stations.csv

[](#stationscsv)

This file describes all NMBS/SNCB stations in Belgium. A station can have multiple platforms (stops), which are described in `stops.csv`.

- `URI`: this is the URI where we can find more information (such as the real-time departures) about this station (this already contains the ID of the NMBS/SNCB as well)
- `longitude`: the longitude of the station
- `latitude`: the latitude of the station
- `name`: the most neutral name of the station (e.g., in Wallonia use the French name, for Brussels use both, for Flanders use nl name)
- `alternative-fr`: alt. name in French, if available
- `alternative-nl`: alt. name in Dutch, if available
- `alternative-de`: alt. name in German, if available
- `alternative-en`: alt. name in English, if available
- `taf-tap-code`: [TSI TAF/TAP](https://mobilit.belgium.be/en/rail/professional-railway-transport/taf-tap) number for the station Source: [Infrabel Operational point of the railway network ](https://opendata.infrabel.be/explore/dataset/operationele-punten-van-het-netwerk/table/?sort=ptcarid).
- `telegraph-code`: abbreviated name for Belgian stations, used by NMBS/SNCB internally. Source: [Infrabel Network Statement](https://infrabel.be/en/networkstatement), [attachment D](https://infrabel.be/sites/default/files/generated/files/paragraph/NV_BijlagenD_RIEI_26.zip) file *D06-RIEI-12\_N\_20230915.pdf*.
- `country-code`: the code of the country the station belongs to
- `avg_stop_times`: the average number of vehicles stopping each day in this station (*computed field*)
- `official_transfer_time`: the time needed for an average person to make a transfer in this station, according to official sources (NMBS/SNCB) (*computed field*)

### stops.csv

[](#stopscsv)

This file describes all NMBS/SNCB stops in Belgium. Each platform is a separate stop location. All fields are computed using `gtfs_data_extractor.php`.

- `URI`: this is the URI where we can find more information about this stop/platform (exists out of URI of the parent station + '#' + platform code)
- `parent_stop`: this is the URI of the parent stop defined in stations.csv
- `longitude`: the longitude of the stop
- `latitude`: the latitude of the stop
- `name`: stop name
- `alternative-fr`: alt. name in French, if available
- `alternative-nl`: alt. name in Dutch, if available
- `alternative-de`: alt. name in German, if available
- `alternative-en`: alt. name in English, if available
- `platform`: the platform code (can also consist of letters, so do not treat this as a number!)

### facilities.csv

[](#facilitiescsv)

This file describes facilities available in NMBS/SNCB stations. All fields are computed using `web_facilities_extractor.php`.

- `URI`: The URI identifying this station.
- `name`: The name of this station.
- `street`: The street of this station's address.
- `zip`: The postal code of this station's address.
- `city`: The city of this station's address.
- `ticket_vending_machine`: Whether or not ticket vending machines are available. Note: Ticket vending machines might be located inside a building (and can be locked when the station is closed).
- `luggage_lockers`: Whether or not luggage lockers are available.
- `free_parking`: Whether or not free parking spots are available.
- `taxi`: Whether or not parking spots for taxis / waiting taxis are available.
- `bicycle_spots`: Whether or not bicycle parking spots are available.
- `blue-bike`: Whether or not the has blue-bikes (rental bikes).
- `bus`: Whether or not transferring to a bus line is possible in this station.
- `tram`: Whether or not transferring to a tram line is possible in this station.
- `metro`: Whether or not transferring to a metro line is possible in this station.
- `wheelchair_available`: Whether or not the station has wheelchairs available.
- `ramp`: Whether or not the station has a ramp for wheelchair users to board a train.
- `disabled_parking_spots`: The number of reserved parking spots for travellers with a disability.
- `elevated_platform`: Whether or not the station has elevated platforms.
- `escalator_up`: Whether or not the station has an ascending escalator from or to the platform(s).
- `escalator_down`: Whether or not the station has a descending escalator from or to the platform(s).
- `elevator_platform`: Whether or not the station has an elevator to the platform(s).
- `audio_induction_loop `: Whether or not an Audio induction loop (Dutch: Ringleiding) is available.
- `sales_open_monday` - `sales_open_sunday`: The time at which ticket boots open on this day of the week.
- `sales_close_monday` -`sales_close_sunday`:The time at which ticket boots close on this day of the week.

### embarkment\_statistics.csv

[](#embarkment_statisticscsv)

This file describes how many people embark a train at the given station per day. Statistics from october 2023, source: [belgiantrain.be, Cijfers opgestapte reizigers](https://www.belgiantrain.be/nl/about-sncb/enterprise/publications/travellers-counts)

- `URI`: The URI identifying this station.
- `name`: The name of this station.
- `nmbs_short_name`: The short name of this station, as used in the original source data. For verification and future update purposes.
- `average_weekday_embarkments`: The average number of travelers embarking on a weekday. Empty when a station does not have traffic on weekdays.
- `average_saturday_embarkments`: The average number of travelers embarking on a saturday. Empty when a station does not have traffic on saturdays.
- `average_sunday_embarkments`: The average number of travelers embarking on a sunday. Empty when a station does not have traffic on sundays.

How we collect data
-------------------

[](#how-we-collect-data)

This repository contains two PHP scripts which can load all data from the NMBS GTFS public data and the NMBS website. These scripts can be used to generate all CSV files from scratch, and to update existing files.

Manual changes and corrections can be made to `stations.csv`. It is recommended to use the `stations.csv` file in this repository as a starting point instead of using the scripts to generate this file, as the repository versions includes manual fixes to station names and translations.

**Any changes made to `stops.csv` or `facilities.csv` will be overwritten by the scripts.** Therefore, any pull requests with the sole purpose of updating/modifying these files won't be accepted

Missing stations and missing fields in `stations.csv` are automatically added when the gtfs\_data\_extractor tool runs.

### How to make a correction

[](#how-to-make-a-correction)

Corrections to names, translations and locations can be made by adjusting fields in `stations.csv`:

- Names or translations will never be overwritten by the scripts.
- Names in `facilities.csv` or `stops.csv` are derived from the names in stations.csv, meaning you only need to update `stations.csv`.
- The GTFS data extractor script will warn on wrong locations, but won't correct them.

If you want to make a correction to `facilities.csv` or `stops.csv`, don't fix the files, but fix the scripts instead, and let these scripts run to update the file for you.

In case you just want to reuse the data
---------------------------------------

[](#in-case-you-just-want-to-reuse-the-data)

### Latest update over HTTP

[](#latest-update-over-http)

JSON-LD is available at  if you add the right accept header. For example, using curl on the command line, you would do this:

```
curl -H "accept: application/json" https://irail.be/stations/NMBS
```

If you want to change this output, please change the CSV files over here first (we love pull requests)

### In PHP project

[](#in-php-project)

Using composer (mind that we also require nodejs to be installed on your system in order to use the linked-data interface):

```
composer require irail/stations
```

Then you can use the stations in your code as follows:

```
use irail\stations\Stations;
use irail\stations\StationsLd;
// Using the strongly typed CSV parser:
// getStations() returns a irail\stations\Station array
$brusselsnorth = Stations::getStations("Brussels North")[0];
// getStationByID($id) returns a irail\stations\Station object with the station or null
$ghentstpieters = Stations::getStationByID("http://irail.be/stations/NMBS/008892007");

// Using the linked-data interface
// getStations() returns a json-ld document
$brusselsnorth = StationsLd::getStations("Brussels North")->{"@graph"}[0];
// getStationByID($id) returns a simple object with the station or null
$ghentstpieters = StationsLd::getStationByID("http://irail.be/stations/NMBS/008892007");
```

Don't forget to do a `composer update` from time to time to update the data

Building the RDF or JSON-LD
---------------------------

[](#building-the-rdf-or-json-ld)

Using scripts, this data can be converted to JSON-LD. In order to run the script, run this command:

First time run this in your terminal (nodejs needs to be installed on your system):

```
npm install
```

Or install it globally using the [npm package](https://www.npmjs.com/package/irail-stations) (you will need to run this again when there's an update to the stations file):

```
npm install -g irail-stations
```

From then on, you can always run:

```
# using this repo
./bin/build.js
# or with the global package:
irail-stations
```

For extra commands, check:

```
./bin/build.js --help
# or
irail-stations --help
```

We currently support the output formats **TRiG**, **N-Quads** and **JSON-LD** (default)

License
-------

[](#license)

[CC0](https://creativecommons.org/publicdomain/zero/1.0/): This dataset belongs to the public domain. You're free to reuse it without any restrictions whatsoever.

If you contribute to this repository, you agree that your contributions will be licensed under the CC0 open data license.

We do appreciate a link back to this repository, or a mention of the [iRail project](http://hello.irail.be).

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance61

Regular maintenance activity

Popularity34

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~5 days

Total

69

Last Release

557d ago

Major Versions

1.9.2 → 2.0.22024-04-10

1.9.3 → 2.0.32024-04-10

1.9.5 → 2.0.52024-04-28

1.9.6 → 2.0.72024-07-25

1.x-dev → 2.0.92024-08-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/af95b988ec0a5527b14f7ff9d0c3c43b0b89f0abaff5b741f6be4c37aaebe4b8?d=identicon)[pietercolpaert](/maintainers/pietercolpaert)

![](https://www.gravatar.com/avatar/eb5a2417d5162c99a09ba22812d255d8b47b2a4bee2592f105beac606df890e7?d=identicon)[Bertware](/maintainers/Bertware)

---

Top Contributors

[![Bertware](https://avatars.githubusercontent.com/u/1094793?v=4)](https://github.com/Bertware "Bertware (148 commits)")[![pietercolpaert](https://avatars.githubusercontent.com/u/347073?v=4)](https://github.com/pietercolpaert "pietercolpaert (47 commits)")[![brechtvdv](https://avatars.githubusercontent.com/u/6189968?v=4)](https://github.com/brechtvdv "brechtvdv (43 commits)")[![jncn](https://avatars.githubusercontent.com/u/995815?v=4)](https://github.com/jncn "jncn (38 commits)")[![Haroenv](https://avatars.githubusercontent.com/u/6270048?v=4)](https://github.com/Haroenv "Haroenv (9 commits)")[![Tjoosten](https://avatars.githubusercontent.com/u/5157609?v=4)](https://github.com/Tjoosten "Tjoosten (6 commits)")[![ChristopheVersieux](https://avatars.githubusercontent.com/u/356214?v=4)](https://github.com/ChristopheVersieux "ChristopheVersieux (4 commits)")[![StanCallewaert](https://avatars.githubusercontent.com/u/10974018?v=4)](https://github.com/StanCallewaert "StanCallewaert (3 commits)")[![Tuinslak](https://avatars.githubusercontent.com/u/306680?v=4)](https://github.com/Tuinslak "Tuinslak (3 commits)")[![DylanVanAssche](https://avatars.githubusercontent.com/u/4999159?v=4)](https://github.com/DylanVanAssche "DylanVanAssche (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![miclf](https://avatars.githubusercontent.com/u/3188746?v=4)](https://github.com/miclf "miclf (1 commits)")[![xivk](https://avatars.githubusercontent.com/u/1128068?v=4)](https://github.com/xivk "xivk (1 commits)")

---

Tags

belgiumjson-ldsncbstations

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/irail-stations/health.svg)

```
[![Health](https://phpackages.com/badges/irail-stations/health.svg)](https://phpackages.com/packages/irail-stations)
```

###  Alternatives

[embed/embed

PHP library to retrieve page info using oembed, opengraph, etc

2.2k11.9M117](/packages/embed-embed)[mediawiki/semantic-meta-tags

An extension to Semantic Mediawiki to add meta elements with content generated from semantic annotations.

1115.5k](/packages/mediawiki-semantic-meta-tags)[strawberryfield/strawberryfield

A strawberry field for Drupal 10/11

113.3k10](/packages/strawberryfield-strawberryfield)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
