Skip to content

Small and simple PHP API client to retrieve Weather Underground data

License

Notifications You must be signed in to change notification settings

leonardfischer/wunderground-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Underground API Client

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