PHP code example of digicraft / laravel-airvisual

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

    

digicraft / laravel-airvisual example snippets


use Digicraft\AirVisualRepository;


// Get Countries are supported by AirVisual API
AirVisualRepository::getSupportedCountries();


// Get States of given country supported by AirVisual API
AirVisualRepository::getSupportedStates($country);


// Get Cities supported by AirVisual API giving a country and state param
AirVisualRepository::getSupportedCities($country, $state);


// Get nearest city data (GPS coordinates)
AirVisualRepository::getNearestCityData($lat, $long);

// Get nearest city data (IP)
AirVisualRepository::getNearestIpCityData($ip);


// Get specified city data
AirVisualRepository::getCityData($country, $state, $city);