| Package Data | |
|---|---|
| Maintainer Username: | edofre |
| Maintainer Contact: | edofre@gmail.com (Edo Freriks) |
| Package Create Date: | 2017-01-09 |
| Package Last Update: | 2017-02-04 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-22 15:01:45 |
| Package Statistics | |
|---|---|
| Total Downloads: | 28 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
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.
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
$api = new NsApi();
$stations = $api->getStations();
$api = new NsApi();
$station = new Station('UT', '','','','','','','','','');
$departing_trains = $api->getDepartures($station);
$api = new NsApi();
$station = new Station('ut', '', '', '', '', '', '', '', '', '');
// We want the actual disturbances and not the unplanned disturbances
$disturbances = $api->getDisturbances($station, true , false);
$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);