PHP code example of mrkriskrisu / db-wagenreihung-php
1. Go to this page and download the library: Download mrkriskrisu/db-wagenreihung-php 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/ */
mrkriskrisu / db-wagenreihung-php example snippets
declare(strict_types=1);
use Carbon\Carbon;
use K118\DB\Exceptions\TrainNotFoundException;
use K118\DB\Wagenreihung;
eate(2023, 3, 1, 13, 11);
$vehicleGroups = Wagenreihung::fetch($trainNumber, $departure);
foreach($vehicleGroups as $vehicleGroup) {
foreach($vehicleGroup->vehicles as $vehicle) {
echo $vehicleGroup->fahrzeuggruppebezeichnung . ': ';
echo $vehicle->fahrzeugnummer . ' (Typ: ' . $vehicle->fahrzeugtyp . ') will be in section ' . $vehicle->fahrzeugsektor . PHP_EOL;
}
}
} catch(TrainNotFoundException $e) {
echo 'Train not found' . PHP_EOL;
}
bash
composer