modulor / weather
get weather from openweathermap api
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/modulor/weather
Requires
- php: >=5.5.0
This package is not auto-updated.
Last update: 2025-10-06 19:23:19 UTC
README
Basic API usage from openweathermap.org
Installation
via Composer:
Create or add the following to composer.json in your project root:
{ "repositories": [ { "type": "vcs", "url": "https://github.com/modulor/weather" } ], "require": { "modulor/weather": "dev-master" } }
run composer install
Example
Get weather by city name
require_once("path/to/vendor/autoload.php"); WeatherAPI\Configs::setApiKey('your_api_key'); $searchWeather = new WeatherAPI\Current\Search(); $searchWeather->setQueryParams(array( 'q' => 'london' )); print_r($searchWeather->execute());
Get weather by geographic coordinates
require_once("path/to/vendor/autoload.php"); WeatherAPI\Configs::setApiKey('your_api_key'); $searchWeather = new WeatherAPI\Current\Search(); $searchWeather->setQueryParams(array( 'lat' => '-22.0622478', 'lon' => '-44.0444834' )); print_r($searchWeather->execute());