PHP code example of ballen / metar

1. Go to this page and download the library: Download ballen/metar 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/ */

    

ballen / metar example snippets


use Ballen\Metar\Metar;

/**
 * Using the default options, the report will be retrieved from the NOAA web service.
 */
$egss = new Metar('EGSS');
echo sprintf('The METAR report for Stansted (EGSS) is: %s', $egss);

/**
 * Alternatively, Flight simulation enthusiasts may wish to retrieve the current VATSIM reports,
 * this can be achieved by changing the default provider like so: 
 */
$egss->setProvider(Ballen\Metar\Providers\Vatsim::class);

/**
* Since version 2.1.0, users can now query the IVAO web service for METARs too by using the 'IVAO' provider method like so:
*/
$egss->setProvider(Ballen\Metar\Providers\Ivao::class);