vatradar/vatsimclient

VATSIM Data Retriever

0.6.0 2023-03-08 21:35 UTC

This package is auto-updated.

Last update: 2024-05-12 06:24:31 UTC


README

This module retrieves JSON data from VATSIM, does basic sanitization, and provides output in the form of a value object or raw JSON.

Quick Start

<?php

require __DIR__.'/vendor/autoload.php';

use CuyZ\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();