PHP wrapper for Weatherbit.io API
composer require attogram/weatherbit-api-wrapper
<?php
require('path/to/vendor/autoload.php');
$weatherbit = new \Attogram\Weatherbit\Weatherbit();
try {
// Always set your API Key
$weatherbit->setKey('YOUR-WEATHERBIT-API-KEY');
// Set location using one of the setLocationBy*() functions
$weatherbit->setLocationByCity('Amsterdam', 'NL');
// Gets array of current weather data
$currentWeather = $weatherbit->getCurrent();
} catch (Exception $exception) {
exit('Error: ' . $exception->getMessage());
}
print_r($currentWeather);