https://github.com/dnnskrgr/easytrias-php-proxy
PHP-based Proxy API for querying real-time departure data via the TRIAS interface
https://github.com/dnnskrgr/easytrias-php-proxy
api php public-transit public-transport trias
Last synced: 23 days ago
JSON representation
PHP-based Proxy API for querying real-time departure data via the TRIAS interface
- Host: GitHub
- URL: https://github.com/dnnskrgr/easytrias-php-proxy
- Owner: dnnskrgr
- License: apache-2.0
- Created: 2025-05-05T22:07:02.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2025-05-06T21:58:13.000Z (24 days ago)
- Last Synced: 2025-05-06T22:36:06.932Z (24 days ago)
- Topics: api, php, public-transit, public-transport, trias
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easyTRIAS โ Proxy API for the TRIAS interface
**easyTRIAS** is an unofficial PHP-based proxy API for querying **real-time departure data from stops** via the **TRIAS interface**.The API supports **multiple output formats**, **simple caching**, and can be deployed on any standard web server with minimal setup.
## โน๏ธ What is TRIAS?
TRIAS is an **XML-based, standardized exchange format for travel information systems** developed by the VDV (Verband Deutscher Verkehrsunternehmen). It is used for structured communication between passenger information systems, timetable services, and third-party applications.
TRIAS is flexible, standardized, and powerful โ but is **currently not in widespread use in Germany**. However, many transport companies and timetable data pools are working on deploying TRIAS or are in pilot phases.
You can find more information about TRIAS and its documentation here: https://www.vdv.de/ip-kom-oev.aspx
## ๐ง Requirements
- Web server with **PHP 7.2 or higher**- **Write permissions** for the configured cache directory
- **Access to a TRIAS endpoint** (e.g., via [Connect Niedersachsen](https://connect-fahrplanauskunft.de/datenbereitstellung) or [MobiData BW](https://www.mobidata-bw.de/dataset/trias))
## ๐ฆ Features
- Query real-time departure data via the TRIAS interface- Multiple output formats: `json`, `xml`, `csv`, `html`, `raw`
- Caching to reduce external API requests
- Walking time filtering
- Transport Types with icon & color coding
## ๐งฎ Input parameters
| Parameter | Type | Required | Default | Description |
|------------------|----------|----------|-----------|---------------|
| `stopPointRef` | string | โ | โ | TRIAS stop ID (e.g. `de:03241:31`) |
| `format` | string | โ | `html` | Output format (`json`, `xml`, `csv`, `html`, `raw`) |
| `walkingMinutes` | integer | โ | `0` | Walking time to the stop in minutes โ earlier departures are filtered |
| `forceRefresh` | `0`/`1` | โ | `0` | If set to `1`, the cache will be bypassed and a fresh request is made |## ๐งช Example calls
1. **HTML table:**
```bash
https://example.com/departures.php?stopPointRef=de:03241:31
```
2. **JSON with walking time filter:**
```bash
https://example.com/departures.php?stopPointRef=de:03241:31&format=json&walkingMinutes=5
```
3. **Raw TRIAS XML for debugging:**
```bash
https://example.com/departures.php?stopPointRef=de:03241:31&format=raw
```## ๐๏ธ Caching
- Each query is cached for **10 minutes** by default to reduce external API calls- Cache files are stored in the `/cache` directory, which is created automatically if it doesn't exist
- You can change the cache duration and directory path in the `/.env.ini` configuration file
- To disable caching, set the cache duration to `0`.
## ๐จ Transport icons & colors
- Each transport mode (e.g., bus, train, tram) can be assigned a unique icon and color- These mappings are defined in the `/src/Dictionaries.php` file
- The base URL for icon images can be configured in the `/.env.ini` file
## โ๏ธ License
This project is licensed under the [Apache 2.0 License](https://opensource.org/license/apache-2-0).You may **freely use, modify, and redistribute** the code, even in commercial projects โ as long as the license and copyright notices are retained. Liability is excluded.
## ๐ค Author
๐ค Dennis Krรผger๐ Hanover, Germany
๐ [https://www.denniskr.de](https://www.denniskr.de)
## ๐ฌ Contact / Feedback
Do you have ideas, feedback, or would like to collaborate?Feel free to open an issue on GitHub or reach out directly via email: [email protected]