kayschima/deutsche-bahn is a Laravel package for laravel package for deutsche bahn timetables.
It currently has 0 GitHub stars and 7 downloads on Packagist (latest version v1.0.1).
Install it with composer require kayschima/deutsche-bahn.
Discover more Laravel packages by kayschima
or browse all Laravel packages to compare alternatives.
Last updated
"Deutsche Bahn" is a laravel package for timetables of german railway stations
Via Composer
$ composer require kayschima/deutsche-bahn
Publish the config file
$ php artisan vendor:publish --provider "Kayschima\DeutscheBahn\DeutscheBahnServiceProvider"
The usage of the package is quite simple:
DEUTSCHE_BAHN_API_TOKEN=YOUR_API_TOKEN
You can use three different functions in this package:
use Kayschima\DeutscheBahn\Facades\DeutscheBahn;
$arrivals = DeutscheBahn::getArrivals('8000050', new DateTime('now'),true);
$departures = DeutscheBahn::getDepartures('8000050', new DateTime('now'), false);
$trainDetails = DeutscheBahn::getDetails('8000050hewrl7127871329172023440423023lhlhllklhlh50');
The first two functions expect
If you want to know details about a specific train journey, enter the id of that train journey in the 'getDetails' function. You might get these ids by calling 'getArrivals' or 'getDepartures' before.
All functions return an array as a result. In later versions of the package we will also pass the results of the REST call on to the user.
Until then, an empty array is returned as the function result if an error occurs when calling the Deutsche Bahn api or the function has generally not determined any results.
This package also provides an artisan coommand to get the id of a certain railway station of Deutsche Bahn.
php artisan deutsche-bahn:railway-station
Just answer the question about the desired train station and a number of possible IDs will be displayed.
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
license. Please see the license file for more information.