OpenWeatherMap PHP API Versions Save

A PHP API to parse weather data and weather history from OpenWeatherMap.org.

v3.3.2

2 years ago
  • Fix deprecation notices on PHP 8.1 (#181, thanks @hevertonfreitas!)

v3.3.1

2 years ago
  • Allow psr/cache versions 1, 2, and 3, #178
  • Test on PHP 8.1 and 8.2

v3.3.0

3 years ago
  • OpenWeatherMap just changed the return format of the UV index API, which was reported and fixed by @mikepsinn. #157
  • psr/http-factory had always been required, but was missing from composer.json. This was fixed by @erickskrauch in #159

v3.2.3

3 years ago

This release fixes an issue where the timezone parsing logic was unable to handle SimpleXMLElements.

Thank you @ChrisB9 for fixing this in #154!

v3.2.2

3 years ago

This release fixes an issue where OWMNotFoundException was never thrown, even when it should have been.

Thank you @robjuz for raising (#150) and fixing (#151) this issue!

v3.2.1

4 years ago

This release brings better support for json_encodeing data returned by this library and minor documentation updates.

  • The Unit class now includes its values in its JSON representation (thank you @1Franck!):
$unit = new Unit(42.5, "°C", "hot", "2.5");
$this->assertEquals(json_encode($unit), '{"value":42.5,"unit":"\u00b0C","description":"hot","precision":2.5}');

v3.2.0

4 years ago

This release brings a small new feature as well as an all-new documentation!

  • The new documentation is hosted at https://cmfcmf.github.io/OpenWeatherMap-PHP-API. It is located inside the docs folder of this repository.
  • Citys now have a timezone property that indicates the cities' timezone. Thank you @hennell-git for working on this in #140!

v3.1.0

4 years ago

This release brings support for OpenWeatherMap's air pollution APIs (currently in beta):

  • Carbon Monoxide Data
  • Ozone Data
  • Sulfur Dioxide Data
  • Nitrogen Dioxide Data

Big thanks to @tomtomklima for kicking this off by working on the carbon monoxide API in #138!

We also fixed a bug related to missing wind directions when using the weather group API reported by @KarelWintersky in #137.

v3.0.0

4 years ago

Version 3 comes with a few bug fixes and new and removed features.

  • [Breaking]: The minimum required PHP version is now PHP 7.0
  • [Breaking]: Support for the Weather History API has been removed. It is unfortunately not possible for me to test the integration, because it requires a paid API key.
  • [Breaking]: Caching OWM responses no longer uses a custom cache implementation (Cmfcmf\OpenWeatherMap\AbstractCache) but instead PSR-6 compatible caches.
  • [Breaking]: Custom Cmfcmf\OpenWeatherMap\Fetcher\FetcherInterface classes dropped in favor of PSR-18 compatible HTTP clients. You now need to pass a PSR-18 compatible HTTP client as well as a PSR-17 compatible HTTP request factory to the OpenWeatherMap constructor. You will need to choose and install two additional dependencies separately:
    1. A PSR-17 compatible HTTP factory implementation. A list of HTTP factory implementations is available at Packagist.
    2. A PSR-18 compatible HTTP client implementation. A list of HTTP client implementations is available at Packagist.

Example for Guzzle (php-http/guzzle6-adapter, http-interop/http-factory-guzzle):

use Http\Factory\Guzzle\RequestFactory;
use Http\Adapter\Guzzle6\Client as GuzzleAdapter;

$httpRequestFactory = new RequestFactory();
$httpClient = GuzzleAdapter::createWithConfig([]);
$owm = new OpenWeatherMap($myApiKey, $httpClient, $httpRequestFactory);
  • [Breaking]: Removal of long-deprecated getRawData() method. Use getRawWeatherData instead.
  • [Breaking]: The units for temperatures previously were K, °C and F. Now they are K, °C and °F.
  • [Breaking]: The UV index API has been expanded to support historic uv index data and forecast UV index data: getCurrentUVIndex, getForecastUVIndex and getHistoricUVIndex (thanks to @roelvanhintum).
  • ext-json, ext-libxml and ext-simplexml have always been implicitly required, but are now explicitly required in composer.json (thanks to @gloomy).

v2.4.0

5 years ago

Up until now, we were using HTTP urls for the API calls to OpenWeatherMap. Thanks to @Erulezz, we now use the more secure HTTPS versions.







Buy Me a Coffee at ko-fi.com
Your donations help me put more time into Open-Source software development.