Releases: cmfcmf/OpenWeatherMap-PHP-API
Releases · cmfcmf/OpenWeatherMap-PHP-API
v3.4.0
Fix deprecation notices on PHP 8.1
- Fix deprecation notices on PHP 8.1 (#181, thanks @hevertonfreitas!)
 
Add support for psr/cache version 2 and 3
- Allow 
psr/cacheversions 1, 2, and 3, #178 - Test on PHP 8.1 and 8.2
 
Fix UV index API, add psr/http-factory requirement
- OpenWeatherMap just changed the return format of the UV index API, which was reported and fixed by @mikepsinn. #157
 psr/http-factoryhad always been required, but was missing fromcomposer.json. This was fixed by @erickskrauch in #159
Fix parsing of timezones in certain edge cases
Correct detection of "404 Not Found" errors
Better JSON serialization of `Unit`s
This release brings better support for json_encodeing data returned by this library and minor documentation updates.
- The 
Unitclass 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}');Docs website, timezone property for cities
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 
docsfolder of this repository. Citys now have atimezoneproperty that indicates the cities' timezone. Thank you @hennell-git for working on this in #140!
Support air pollution APIs
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.
PHP 7, PSR-6,17,18, UVIndex Improvements
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\FetcherInterfaceclasses 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 theOpenWeatherMapconstructor. You will need to choose and install two additional dependencies separately: 
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. UsegetRawWeatherDatainstead. - [Breaking]: The units for temperatures previously were 
K,°CandF. Now they areK,°Cand°F. - [Breaking]: The UV index API has been expanded to support historic uv index data and forecast UV index data: 
getCurrentUVIndex,getForecastUVIndexandgetHistoricUVIndex(thanks to @roelvanhintum). ext-json,ext-libxmlandext-simplexmlhave always been implicitly required, but are now explicitly required incomposer.json(thanks to @gloomy).