php-weather / openweathermap
OpenWeatherMap provider
0.2.1
2024-02-27 19:35 UTC
Requires
- php: ^8
- ext-json: *
- php-weather/core: ^0.4
- php-weather/http-provider: ^0.6
Requires (Dev)
- php-http/guzzle7-adapter: ^1.0
- phpstan/phpstan: ^1.6
- phpunit/phpunit: >=8.0
README
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);