Download the PHP package dle79/open-meteo without Composer
On this page you can find all versions of the php package dle79/open-meteo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dle79/open-meteo
More information about dle79/open-meteo
Files in dle79/open-meteo
Package open-meteo
Short Description Typed PHP 8.4 client for the Open-Meteo API
License MIT
Informations about the package open-meteo
Orionphp Open-Meteo Client
A typed PHP 8.4 client for the Open-Meteo weather API — free, no API key required.
Supports:
- current conditions
- 15-minute intervals
- hourly forecasts
- daily forecasts
- 14+ global and regional weather models
Requirements
- PHP 8.4+
- A PSR-18 HTTP client (e.g. Guzzle, Symfony HttpClient)
- A PSR-17 request factory (e.g.
nyholm/psr7)
Installation
You also need a PSR-18 client and a PSR-17 factory. If you don't have one yet:
Quick Start
Building a Forecast Request
All requests are created through ForecastRequestBuilder. Coordinates are validated on creation — invalid values throw InvalidCoordinatesException.
Every field setter accepts PHP variadic enums. Duplicate entries are deduplicated automatically.
Weather Models
| Constant | Value | Region |
|---|---|---|
BEST_MATCH |
best_match |
Auto-select (recommended) |
ECMWF_IFS |
ecmwf_ifs |
Global |
GFS |
gfs |
Global |
ICON_GLOBAL |
icon_global |
Global |
GEM_GLOBAL |
gem_global |
Global |
JMA_GSM |
jma_gsm |
Global |
UKMO_GLOBAL |
ukmo_global |
Global |
ICON_EU |
icon_eu |
Europe |
ICON_D2 |
icon_d2 |
Germany / Central Europe |
METEOFRANCE_ARPEGE |
meteofrance_arpege |
Europe |
METEOFRANCE_AROME |
meteofrance_arome |
France |
DMI_HARMONIE_AROME_EUROPE |
dmi_harmonie_arome_europe |
Europe |
KNMI_HARMONIE_AROME_NETHERLANDS |
knmi_harmonie_arome_netherlands |
Netherlands |
HRRR |
hrrr |
United States |
NAM_CONUS |
nam_conus |
United States |
Model helpers
Combining multiple models
When you request more than one model, each field in the response carries per-model value arrays:
Forecast Intervals
Current conditions
15-minute intervals
Available fields: TEMPERATURE_2M, APPARENT_TEMPERATURE, RELATIVE_HUMIDITY_2M, DEW_POINT_2M, PRECIPITATION, RAIN, SNOWFALL, SHOWERS, WEATHER_CODE, CLOUD_COVER, WIND_SPEED_10M, WIND_DIRECTION_10M, WIND_GUSTS_10M, VISIBILITY, SHORTWAVE_RADIATION, DIRECT_RADIATION, DIFFUSE_RADIATION, DIRECT_NORMAL_IRRADIANCE
Hourly
Available fields include: TEMPERATURE_2M, APPARENT_TEMPERATURE, WEATHER_CODE, RELATIVE_HUMIDITY_2M, DEW_POINT_2M, PRECIPITATION, PRECIPITATION_PROBABILITY, RAIN, SHOWERS, SNOWFALL, SNOW_DEPTH, CLOUD_COVER, WIND_SPEED_10M, WIND_DIRECTION_10M, WIND_GUSTS_10M, PRESSURE_MSL, SURFACE_PRESSURE, VISIBILITY, UV_INDEX, SHORTWAVE_RADIATION, DIRECT_RADIATION, DIFFUSE_RADIATION, DIRECT_NORMAL_IRRADIANCE, EVAPOTRANSPIRATION, ET0_FAO_EVAPOTRANSPIRATION, VAPOUR_PRESSURE_DEFICIT, CAPE, and soil temperature fields at 0 cm, 6 cm, 18 cm, 54 cm.
Daily
Available fields: WEATHER_CODE, TEMPERATURE_2M_MAX, TEMPERATURE_2M_MIN, APPARENT_TEMPERATURE_MAX, APPARENT_TEMPERATURE_MIN, PRECIPITATION_SUM, PRECIPITATION_PROBABILITY_MAX, RAIN_SUM, SHOWERS_SUM, SNOWFALL_SUM, SNOW_DEPTH_MAX, WIND_SPEED_10M_MAX, WIND_GUSTS_10M_MAX, WIND_DIRECTION_10M_DOMINANT, SUNRISE, SUNSET, SUNSHINE_DURATION, UV_INDEX_MAX, SHORTWAVE_RADIATION_SUM, ET0_FAO_EVAPOTRANSPIRATION
Weather Code Translations
WMO weather codes returned by the API can be translated to human-readable strings in multiple languages.
Supported locales: de, en, es, fr
Translation files are plain PHP arrays. You can supply your own locale directory:
A locale file must return an array<int, string> keyed by WMO weather code integer.
Logging
OpenMeteoClient accepts any PSR-3 logger as an optional third constructor argument. When omitted, a NullLogger is used.
Logged events:
| Level | Event |
|---|---|
info |
Outgoing request URL |
error |
HTTP client exception |
error |
Non-2xx response status |
error |
Invalid or unexpected JSON |
Error Handling
All exceptions extend OpenMeteoException. Catch specifically or broadly as needed:
Development
CI runs automatically on every push and pull request via GitHub Actions.
License
MIT — see LICENSE for details.
All versions of open-meteo with dependencies
psr/log Version ^3.0
psr/http-client Version ^1.0
psr/http-message Version ^2.0
psr/http-factory Version ^1.1