rensphilipsen/laravel-ns-api

用于荷兰铁路公司(NS)API的Laravel包装器

v1.0.4 2023-06-19 13:50 UTC

This package is auto-updated.

Last update: 2024-09-19 16:26:04 UTC


README

此包是荷兰铁路公司(NS)API的包装器。

安装

通过composer安装

composer require rensphilipsen/laravel-ns-api

配置

运行以下命令发布配置

php artisan vendor:publish --provider="RensPhilipsen\NSApi\NSApiServiceProvider" --tag="config"

示例

获取所有车站

为了获取所有NS车站

    $api = new NSApi();

    // Optionally set a limit as first parameter, defaults to 0 which is all stations
    $api->getStations(32);

通过车站代码获取出发信息

    $api = new NSApi();

    // The first parameter is the stations `code`.
    // The second parameter (optional) is the amount of departures/journeys. Defaults to 32.
    $api->getDeparturesByStationCode('ut', 32)

通过车站代码获取到达信息

    $api = new NSApi();

    // The first parameter is the stations `code`.
    // The second parameter (optional) is the amount of arrivals/journeys. Defaults to 32.
    $api->getArrivalsByStationCode('ut', 32)