Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.5 KB

README.md

File metadata and controls

36 lines (26 loc) · 1.5 KB

PHP Weather Provider for OpenWeatherMap

Packagist Version
PHP Weather Common Version PHP Weather HTTP Provider Version
GitHub Release Date GitHub commits since tagged version GitHub last commit
GitHub Workflow Status GitHub Packagist PHP Version Support

This is the OpenWeatherMap provider from PHP Weather.

Installation

Via Composer

composer require php-weather/openweathermap

Usage

$openWeatherMapKey = 'key';

$httpClient = new \Http\Adapter\Guzzle7\Client();
$openweathermap = new \PhpWeather\Provider\OpenWeatherMap\OpenWeatherMap($httpClient, $openWeatherMapKey);

$latitude = 47.873;
$longitude = 8.004;

$currentWeatherQuery = \PhpWeather\Common\WeatherQuery::create($latitude, $longitude);
$currentWeather = $openweathermap->getCurrentWeather($currentWeatherQuery);