PHPackages                             ddreher/db-api-client - 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. [API Development](/categories/api)
4. /
5. ddreher/db-api-client

ActiveLibrary[API Development](/categories/api)

ddreher/db-api-client
=====================

A php client library for the deutsche bahn timetable API

v0.0.1(10y ago)041[1 issues](https://github.com/dredav/db-api-client/issues)MITPHP

Since May 19Pushed 8y ago2 watchersCompare

[ Source](https://github.com/dredav/db-api-client)[ Packagist](https://packagist.org/packages/ddreher/db-api-client)[ Docs](https://github.com/dredav/db-api-client)[ RSS](/packages/ddreher-db-api-client/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

db-api-client
=============

[](#db-api-client)

This is a php client library for the deutsche bahn timetable API. The deutsche bahn is the biggest railway company in Germany and published in November 2015 the open data project which provides the data source. This project provides a client and wrapper classes for interaction with the API.

### Available data

[](#available-data)

At this state, there are only data available which belongs the long distance trains.

- Station search
- Departure Board
- Arrivals board
- Train route

Usage
-----

[](#usage)

To install the client we recommended use composer.

**Install composer**

```
curl -sS https://getcomposer.org/installer | php
```

**Require the libary**

```
php composer.phar require ddreher/db-api-client
```

**Connect the composer autoloader**

```
require 'vendor/autoload.php';
```

**Use the client**

```
$client = new DBClient([
    'authKey' => 'PutYourAPIKeyHere',
]);

$client->request(...);
```

Examples
--------

[](#examples)

This example will shows how to list all departing trains from Frankfurt (Main) Hauptbahnhof. The api returns the next 20 trains departing in the period between the submitted time and two hours.

```
$client = new DBClient([
    'authKey' => 'PutYourAPIKeyHere',
]);

foreach($client->request(StationBoard::create('008000105', new \DateTime(), StationBoard::DEPARTURE)) as $trainBoard)
{
    var_dump($trainBoard);
}
```

For train station in Germany you can also use the short station id (e.g. remove the 008 and all leading 0), for Frankfurt (Main) Hauptbahnhof it will be 105. You can also determine the station id from the API, while searching train stations (see the example [examples/findStation.php](examples/findStation.php)). All examples are available in the [examples folder](examples).

Obtain API key
--------------

[](#obtain-api-key)

To obtain an API key, please read the instructions at .

Known issues
------------

[](#known-issues)

- One of the biggest issues is that all times from the API are published without timezone information. This is relevant for trains who's crossing multiple timezones.

License
-------

[](#license)

The API data from deutsche bahn are published under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.

This library is published unter the MIT license.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3695d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4201607?v=4)[Daniel Dreher](/maintainers/ddreher)[@DDreher](https://github.com/DDreher)

---

Top Contributors

[![dredav](https://avatars.githubusercontent.com/u/731073?v=4)](https://github.com/dredav "dredav (12 commits)")

---

Tags

apiopen datatimetabletrainbahndeutsche bahnstations

### Embed Badge

![Health badge](/badges/ddreher-db-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/ddreher-db-api-client/health.svg)](https://phpackages.com/packages/ddreher-db-api-client)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M84](/packages/openai-php-laravel)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

617.2M37](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M12](/packages/checkout-checkout-sdk-php)[plivo/plivo-php

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1143.1M19](/packages/plivo-plivo-php)[plivo/php-sdk

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1112.0M6](/packages/plivo-php-sdk)

PHPackages © 2026

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