PHP code example of jzawadzki / metar-php
1. Go to this page and download the library: Download jzawadzki/metar-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/ */
jzawadzki / metar-php example snippets
$metar = new \METAR\Message("EPKK 160030Z 06010KT 8000 BKN060 04/M03 Q1034");
echo $metar->getLocation(); //EPKK
echo $metar->getVisibility(); //8000
echo $metar->getQNH()->toHPa(); //1034
echo $metar->getQNH()->toInHg(); //30.53
echo $metar->getTemperature()->toUnit('C'); //4
echo $metar->getDewPoint()->toUnit('F'); //26.6
$view = new \METAR\View\Text($metar);
echo $view->render();
/*
METAR: EPKK 160030Z 06010KT 8000 BKN060 04/M03 Q1034
Location: EPKK
Day of month: 16 Time: 0030Z
Temperature: 4.0C Dew point: -3.0C
QNH: 1034 hPa (30.53 inHg)
*/
sh
$ composer