PHP code example of cobaltgrid / vatsim-stand-status
1. Go to this page and download the library: Download cobaltgrid/vatsim-stand-status 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/ */
cobaltgrid / vatsim-stand-status example snippets
// Sets the maximum allowed altitude to 4000ft, and searches aircraft within 5km of defined centre
$standStatus->setMaxAircraftAltitude(4000)->setMaxStandDistance(5)->parseData();
use CobaltGrid\VatsimStandStatus\StandStatus;
$StandStatus = new StandStatus(
51.148056,
-0.190278,
StandStatus::COORD_FORMAT_CAA
);
$standStatus->fetchAndLoadStandDataFromOSM($icao)->parseData();
// Example for Heathrow
$StandStatus = new StandStatus(51.4775, -0.461389);
$standStatus->fetchAndLoadStandDataFromOSM('EGLL')->parseData();
$standStatus->parseData();
use CobaltGrid\VatsimStandStatus\StandStatus;
$standStatus = new StandStatus(
51.148056,
-0.190278,
StandStatus::COORD_FORMAT_CAA);
$standStatus->loadStandDataFromCSV('path/to/data.csv')->parseData();
foreach ($standStatus->stands() as $stand){
if ($stand->isOccupied()) {
echo "Stand {$stand->getName()} is occupied by {$stand->occupier->callsign}</br>";
}else{
echo "Stand {$stand->getName()} is not occupied </br>";
}
}
// Output:
// Stand 1 is occupied by SHT1G
// Stand 2 is not occupied
foreach ($standStatus->occupiedStands() as $stand){
echo "Stand {$stand->getName()} is occupied by {$stand->occupier->callsign}</br>";
}
// Output:
// Stand 1 is occupied by SHT1G
// Stand 3L is occupied by DLH49Y
foreach ($standStatus->allAircraft() as $aircraft){
if($aircraft->onStand()){
$stand = $aircraft->getStand($standStatus->allStands());
echo "{$aircraft->callsign} is on stand {$stand->getName()}</br>";
}else{
echo "{$aircraft->callsign} is not on stand</br>";
}
}
// Output:
// BAW53M is not on stand
// EZY48VY is on stand 554
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.