Skip to content

mohsin/awhere-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is an API client library for the aWhere weather APIs.

Usage

The first step is setting up an API client and fetching a fresh token:

$client = new aWhere\Client($clientId, $clientSecret);
$token = $client->getToken();

You may cache/save the token and pass it as the 3rd paramter to the client to re-use it (You can use isTokenValid() method to determine usability of the passed token).

Next, you may call the relevant API to fetch the data. In this initial release, I have only added the Forecast Weather by Geolocation API node for now (and only the basic usage without startDate/endDate). I will add more API nodes in upcoming versions of this library.

$client->getWeatherForecastByGeolocation($latitude, $longitude, $options);

$options corresponds to the query string parameters specified in the documentation. For example,

$options = [
  'limit' => 15,
  'blockSize' => 12,
  'conditionsType' => 'basic',
  'useLocalTime' => true
];

Contributing

Feel free to make PRs in case you want to update this library with more API nodes.

About

Unofficial PHP client for aWhere weather API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages