PHP code example of risan / sl

1. Go to this page and download the library: Download risan/sl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

risan / sl example snippets



// Include autoloder file.

$sl = new Sl\Sl();

// Search for station.
// Will return Sl\Collections\StationColection.
$stations = $sl->searchStation('Central Station');

// Find for departures.
// Will return Sl\Collections\DepartureColection.
$departures = $sl->departuresFrom($stations->first());

$sl->searchStation(string $query);

$sl = new Sl\Sl();

$stations = $sl->searchStation('central');

print_r($stations->toArray());

$sl->departuresFrom(Sl\Station $station);

$sl = new Sl\Sl();

$slussen = $sl->searchStation('slussen')->first();

$departures = $sl->departuresFrom($slussen);

print_r($departures->toArray());

$sl->departuresFrom(Sl\Station $station)->busses();

$sl->departuresFrom(Sl\Station $station)->trains();

$sl->departuresFrom(Sl\Station $station)->metros();

$sl->departuresFrom(Sl\Station $station)->metros();

$sl->departuresFrom(Sl\Station $station)->lightRails();

$sl->departuresFrom(Sl\Station $station)->ships();