edofre/laravel-ns-api
Composer 安装命令:
composer require edofre/laravel-ns-api
包简介
Laravel wrapper for the NS API
README 文档
README
Installation
The preferred way to install this extension is through composer.
To install, either run
$ php composer.phar require edofre/laravel-ns-api
or add
"edofre/laravel-ns-api": "v1.0.0"
to the require section of your composer.json file.
Configuration
Publish assets and configuration files
php artisan vendor:publish --tag=config
In the above configuration file you will need to enter your NS API username and password
Example
Get all the stations
$api = new NsApi(); $stations = $api->getStations();
Get all the departing trains from a station
$api = new NsApi(); $station = new Station('UT', '','','','','','','','',''); $departing_trains = $api->getDepartures($station);
Get all the disturbances from a station
$api = new NsApi(); $station = new Station('ut', '', '', '', '', '', '', '', '', ''); // We want the actual disturbances and not the unplanned disturbances $disturbances = $api->getDisturbances($station, true , false);
Get the prices for a route
$api = new NsApi(); $from_station = new Station('ZL', '', '', '', '', '', '', '', '', ''); $via_station = new Station('DH', '', '', '', '', '', '', '', '', ''); $to_station = new Station('HT', '', '', '', '', '', '', '', '', ''); $prices = $api->getPrices($from_station, $to_station, $via_station);
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-10