php-weather/open-meteo

Open Meteo provider

0.3.2 2024-02-27 19:22 UTC

This package is auto-updated.

Last update: 2024-10-27 20:50:58 UTC


README

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 Open Meteo provider from PHP Weather.

Open-Meteo collaborates with National Weather Services providing Open Data with 11 to 2 km resolution. Our high performance APIs select the best weather model for your location and provide data as a simple JSON API.
APIs are free without any API key for open-source developers and non-commercial use.

Installation

Via Composer

composer require php-weather/open-meteo

Usage

$httpClient = new \Http\Adapter\Guzzle7\Client();
$openMeteo = new \PhpWeather\Provider\OpenMeteo\OpenMeteo($httpClient);

$latitude = 47.873;
$longitude = 8.004;

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