lfischer/wunderground-api

A simple PHP library for querying the Weather Underground API.

0.2.1 2020-10-30 15:16 UTC

This package is auto-updated.

Last update: 2024-05-29 04:08:46 UTC


README

This library shall help you integrate the WeatherUnderground API to your webservice. It is extremely lightweight and provides all necessary code.

Code Example

Using the API is very easy - you'll only need to provide a API key (Get one here) in order to use it. There are functions for retrieving different weather data by predefined conditions, like "by country and city", "by latitude and longitude", "by airport code" or even "by IP address".

// By default the current conditions will be requested in english language.
$weather = (new \lfischer\wunderground\API('<API-key here>'))->getByLocation('Germany', 'Dusseldorf');

Run tests

Install the dependencies:

composer install

and run the tests:

./vendor/bin/phpunit

Uncommenting the <logging> element of phpunit.xml configuration file will generate the coverage html file when the tests are run.

Future to-dos / nice-to-have

At some point I'd like to improve this client to be as readable as possible. For example:

use lfischer\wunderground;
 
$weather = (new API('<API-key here>'))
    ->getConditions()
    ->byLocation('Germany', 'Dusseldorf')
    ->fetch()
    ->asArray();

Contributors