Download the PHP package bolden/open-weather without Composer
On this page you can find all versions of the php package bolden/open-weather. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package open-weather
⚠️ This plugin is no longer maintained — openWeathermap.org weather plugin for Craft CMS 3.x
Integrate weather information from any location right into your Craft CMS 3 website
Requirements
This plugin requires Craft CMS 3 or later and an active API key from openWeathermap.org
Overview
Access the weather information via TWIG functions or AJAX calls. You can choose between simplified and raw representation of weather data. Weather data is stored in your database and only updates when refresh interval has passed in order to save bandwidth and improve performance.
Configuration
- Fill in the openWeathermap API key to use the plugin.
- Setup the refresh interval (minutes) to setup when weather should be updated.
- Use a default location (latitude, longitude) to get the weather.
Using
There are two ways to use the plugin, via twig functions and HTTP requests.
Twig functions
craft.openWeather.simplified(lat, lon)
Given a latitude and longitude returns the simplified version of weather (array).craft.openWeather.raw(lat, lon)
Given a latitude and longitude returns the raw version of weather (array).craft.openWeather.defaultLocation()
Returns the latitude and longitude (as array) of the default location setup in the settings.
HTTP requests
/api/openWeather/lat-lon/<latitude>,<latitude>,<label>
Given a latitude and longitude returns the simplified version of weather data; optionally pass a label parameter to set a custom label for the given location./api/openWeather/default
Returns the simplified version of weather data of the default location as setup in the settings./api/openWeather/raw/lat-lon/<latitude>,<latitude>,<label>
Given a latitude and longitude returns the raw version of weather data; optionally pass a label parameter to set a custom label for the given location./api/openWeather/raw/default
Returns the raw version of weather data of the default location as setup in the settings
Example
Request
GET /api/openWeather/default
Response
Request
GET /api/openWeather/raw/default
Response
Credits
Made with ❤️ by Bolden and free to use!