PHP code example of vatradar / vatsimclient

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

    

vatradar / vatsimclient example snippets




uyZ\Valinor\MapperBuilder;
use GuzzleHttp\Client as HttpClient;
use VatRadar\DataObjects\Vatsim\VatsimData;
use VatRadar\VatsimClient\DataFetcher;
use VatRadar\VatsimClient\IterableSanitizer;
use VatRadar\VatsimClient\Mapper;

// Set up Dependencies
$fetcher = new DataFetcher(new HttpClient(), 'https://status.vatsim.net/status.json');
$sanitizer = new IterableSanitizer();
$mapper = new Mapper(new MapperBuilder(), VatsimData::class);

$client = new \VatRadar\VatsimClient\Client($fetcher, $sanitizer, $mapper);

$vatsimDataObject = $client->retrieve();