New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

edofre/laravel-ns-api

Laravel wrapper for the NS API
28 1
Install
composer require edofre/laravel-ns-api
Latest Version:V1.0.0
PHP:>=5.6.4
Laravel:5
License:MIT
Last Updated:Feb 4, 2017
Links: GitHub  ·  Packagist
Maintainer: edofre

Laravel NS API wrapper

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

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);

Related Packages

railken/lara-eye
38,923 38
api
juampi92/api-resources

Manage your resources maintaining API versioning

934,651 112
tailflow/laravel-orion

Orion for Laravel allows you to build a fully featured REST API based on your El...

837,569 1,591
unlu/laravel-api-query-builder

Laravel API Query Builder Package.

721,013 329
juampi92/phecks

A package to run custom PHP checks

412,332 4

Version History

Version Released PHP Laravel License
V1.0.0 >=5.6.4 5.3.* MIT