PHP wrapper for Weatherbit.io API
composer require attogram/weatherbit-api-wrapper
- Get an API Key from: https://www.weatherbit.io/
<?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);
- see public/example.php for an example web form
- Github: https://github.com/attogram/weatherbit-api-wrapper/
- Packagist: https://packagist.org/packages/attogram/weatherbit-api-wrapper
- CodeClimate: https://codeclimate.com/github/attogram/weatherbit-api-wrapper
- Travis CI: https://travis-ci.org/attogram/weatherbit-api-wrapper
- Style CI: https://github.styleci.io/repos/244855065