PHPackages                             daviddoran/railtime - 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. daviddoran/railtime

ActiveLibrary

daviddoran/railtime
===================

PHP client for Irish Rail's Realtime Rail XML web service.

761PHP

Since Aug 26Pushed 12y ago3 watchersCompare

[ Source](https://github.com/daviddoran/php-railtime)[ Packagist](https://packagist.org/packages/daviddoran/railtime)[ RSS](/packages/daviddoran-railtime/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Railtime [![Build Status](https://camo.githubusercontent.com/825fa96dbfe857f7183b9096e7e7106b1ee60fd859f61ac03f1095714eca2e83/68747470733a2f2f6170692e7472617669732d63692e6f72672f6461766964646f72616e2f7068702d7261696c74696d652e706e67)](https://travis-ci.org/daviddoran/php-railtime)
=========================================================================================================================================================================================================================================================================================

[](#railtime-)

A PHP library for [Irish Rail's Realtime API](http://api.irishrail.ie/realtime/).

Usage
-----

[](#usage)

The main class exported by this package is `\Railtime\API`.

First, create a new `API` object:

```
use \Railtime\API;

$api = new API;
```

Then, call the various API methods:

```
$stations = $api->stations();
```

The `API` class exposes the following methods:

```
Station[]           stations([$station_type])
RunningTrain[]      current_trains([$train_type])
StationPassing[]    station_passings($name_or_code[, $minutes = null])
TrainMovement[]     train_movements($train_id, $train_date)

```

Make sure to check out the [Examples](#examples) below.

Installing
----------

[](#installing)

This package is [available from Packagist](https://packagist.org/packages/daviddoran/railtime).

To install using Composer, add this to the `"require":` section of your `composer.json` file:

```
"daviddoran/railtime": "dev-master"

```

Once you've [installed Composer](http://getcomposer.org/doc/00-intro.md#installation-nix) simply run:

```
php composer.phar install

```

Or, if you installed composer globally:

```
composer install

```

Tests
-----

[](#tests)

The unit tests are contained in `test` and the configuration in `phpunit.xml`.

After installing dependencies with composer, the following should run the tests:

```
./vendor/bin/phpunit

```

Examples
--------

[](#examples)

#### Get a list of all the Dart stations

[](#get-a-list-of-all-the-dart-stations)

```
$stations = $api->stations(\Railtime\StationTypeDart);
```

#### Get the currently running Mainline trains

[](#get-the-currently-running-mainline-trains)

```
$trains = $api->current_trains(\Railtime\TrainTypeMainline);
```

#### Get a list of the trains passing Howth Junction (default next 90 minutes)

[](#get-a-list-of-the-trains-passing-howth-junction-default-next-90-minutes)

```
//You can use the station's full name
$passings = $api->station_passings("Howth Junction");

//Or use the station's code
$passings = $api->station_passings("HWTHJ");
```

#### Get a list of the trains passing Connolly in the next 15 minutes

[](#get-a-list-of-the-trains-passing-connolly-in-the-next-15-minutes)

```
//You can also use the station code "CNLLY"
$passings = $api->station_passings("Dublin Connolly", 15);
```

#### Get a list of a train's movements on a particular day

[](#get-a-list-of-a-trains-movements-on-a-particular-day)

```
$movements = $api->train_movements("E815", "25 Aug 2013");
```

#### Check how early/late a train was at each station

[](#check-how-earlylate-a-train-was-at-each-station)

```
$movements = $api->train_movements("E815", "18 Aug 2013");
foreach ($movements as $stop) {
    if (!$stop->is_origin()) {
        $mins = round($stop->arrival_diff_seconds() / 60);
        echo "-- ", abs($mins), " min ", ($mins > 0 ? "late" : "early"), " --> ";
    } else {
        echo "-- set off --> ";
    }
    echo $stop->location_fullname, "\n";
}
```

This will output something like:

```
-- set off --> Greystones
-- 0 min early --> Bray
-- 0 min early --> Shankill
-- 1 min late --> Killiney
-- 1 min late --> Dalkey
-- 2 min late --> Glenageary
-- 2 min late --> Sandycove
-- ✂ -- ✂ -- snip -- ✂ -- ✂ --
-- 3 min late --> Kilbarrack
-- 3 min late --> Howth Junction
-- 2 min late --> Clongriffin
-- 2 min late --> Portmarnock
-- 2 min late --> Malahide

```

License
-------

[](#license)

This project is released under the MIT License - see the LICENSE file for details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

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

---

Top Contributors

[![daviddoran](https://avatars.githubusercontent.com/u/313983?v=4)](https://github.com/daviddoran "daviddoran (11 commits)")

### Embed Badge

![Health badge](/badges/daviddoran-railtime/health.svg)

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

PHPackages © 2026

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