Skip to content

h-wang/weather

Repository files navigation

Weather service

A micro-service aggregating weather information from weather providers. It serves as a gateway between the weather information providers (which normally limits the number of request) and the application that depends on weather information.

Installation

composer install

Usage

API

http://localhost/api/v1/current/[location]
http://localhost/api/v1/current/[location]?provider=openweathermap
http://localhost/api/v1/simple/[location]

CLI

php bin/console weather:current [location]
php bin/console weather:current [location] --provider=qweather

Client implementation

$location = 'shenyang';
$url = 'http://localhost/api/v1/current/'.$location;
$weather = file_get_contents($url);
$weather = json_decode($weather, true);
print_r($weather);

Features

The following features are provided:

  • Simple Restful API for apps to call, with JSON return format.
  • Collects weather info from weather providers.
  • Cache weather info per day per location. This is useful for apps that have massive user-base. e.g. digital signage, tourist apps.
  • Support multiple weather providers and convert weather info into the same format.

Supported weather providers:

Supported weather information types:

  • Current weather
  • Lifestyle
  • Air quality
  • Forcast

About

A weather micro-service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages