PHP code example of awaluk / nextbike-api-client

1. Go to this page and download the library: Download awaluk/nextbike-api-client 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/ */

    

awaluk / nextbike-api-client example snippets




waluk\NextbikeClient\HttpClient;
use awaluk\NextbikeClient\Nextbike;

$httpClient = new HttpClient();
$nextbike = new Nextbike($httpClient);

$nextbike = new Nextbike($httpClient, 'https://example.com');



$httpClient = new HttpClient();
$nextbike = new Nextbike($httpClient);
$systems = $nextbike->getSystems()->getAll();

foreach ($systems as $system) {
    echo $system->getName() . ', ';
}



$httpClient = new HttpClient();
$nextbike = new Nextbike($httpClient);
$city = $nextbike->getCity(496);

foreach ($city->getStationCollection()->getAll() as $station) {
    echo 'Station: ' . $station->getName() . ' - available bikes: ' . $station->getBikesAmount() . ', ';
}