PHPackages                             reynevan/imgw-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. reynevan/imgw-php

ActiveLibrary

reynevan/imgw-php
=================

A lightweight, fully typed PHP client for the public IMGW API

v1.0.0(today)11↑2900%MITPHPPHP &gt;=8.1CI passing

Since Aug 24Pushed todayCompare

[ Source](https://github.com/reynevan/imgw-php)[ Packagist](https://packagist.org/packages/reynevan/imgw-php)[ RSS](/packages/reynevan-imgw-php/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (12)Versions (2)Used By (0)

imgw-php
========

[](#imgw-php)

[![PHP Version](https://camo.githubusercontent.com/f68438ddf355683cf79ca20948c280caa497671b543367dcc82cf26cbfabcee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242463f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](composer.json)[![Tests](https://camo.githubusercontent.com/c1415565959c125c16f78eb39feb45172b25c61959d7417f1fc63c12376e35ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d627269676874677265656e3f6c6f676f3d706870756e6974266c6f676f436f6c6f723d7768697465)](tests)[![Coverage](https://camo.githubusercontent.com/6c3c8cab0d69bc88122e8021981eb9e3355df5b74f890b5ec9b4c8bcc489005d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d627269676874677265656e3f6c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465)](phpunit.xml)[![PSR-18](https://camo.githubusercontent.com/863058bb80afac47805906b1458e06e0e0188bb9c0cacf83c4db8f865bd6608f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f687474702d2d636c69656e742d5053522d2d31382d626c7565)](https://www.php-fig.org/psr/psr-18/)

A lightweight, fully typed PHP client for the public IMGW API ([danepubliczne.imgw.pl](https://danepubliczne.imgw.pl)) - synoptic and hydrological station data plus meteorological and hydrological warnings, mapped directly onto DTO objects.

Features
--------

[](#features)

- Synoptic (`synop`) and meteorological (`meteo`) station data
- Hydrological station data (`hydro`)
- Hydrological (`warningshydro`) and meteorological (`warningsmeteo`) warnings
- API responses mapped onto strongly typed DTOs via PHP attributes (`#[ApiField]`)
- Decoupled from any specific HTTP client thanks to PSR-18 (`php-http/discovery` auto-detects an available client)
- 100% test coverage

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- A PSR-18 (`psr/http-client-implementation`) and PSR-17 (`psr/http-factory-implementation`) implementation, e.g. `guzzlehttp/guzzle` + `guzzlehttp/psr7` or `symfony/http-client` + `nyholm/psr7`

Installation
------------

[](#installation)

```
composer require reynevan/imgw-php
```

If your project doesn't have a PSR-18 client yet, install one, e.g. Guzzle:

```
composer require guzzlehttp/guzzle guzzlehttp/psr7
```

Quick start
-----------

[](#quick-start)

```
use Reynevan\Imgw\ImgwClient;

$client = new ImgwClient();

foreach ($client->synop()->getWeatherStations() as $station) {
    printf(
        "%s: %.1f°C\n",
        $station->getName(),
        $station->getTemperature()
    );
}
```

### Synoptic data (`Synop`)

[](#synoptic-data-synop)

```
$synop = $client->synop();

$stations = $synop->getWeatherStations();          // WeatherStation[]
$station  = $synop->getWeatherStationById(12500);   // WeatherStation
$station  = $synop->getWeatherStationByName('Warszawa'); // WeatherStation
```

### Hydrological data (`Hydro`)

[](#hydrological-data-hydro)

```
foreach ($client->hydro()->getHydroStations() as $station) {
    printf(
        "%s (%s): water level %s cm\n",
        $station->getName(),
        $station->getRiver(),
        $station->getWaterLevel()
    );
}
```

### Meteorological data (`Meteo`)

[](#meteorological-data-meteo)

```
foreach ($client->meteo()->getMeteoStations() as $station) {
    printf(
        "%s: %.1f°C\n",
        $station->getName(),
        $station->getAirTemperature()
    );
}
```

### Hydrological warnings (`WarningsHydro`)

[](#hydrological-warnings-warningshydro)

```
foreach ($client->warningshydro()->getWarnings() as $warning) {
    printf(
        "[%s] %s (level %d), valid from %s to %s\n",
        $warning->getOffice(),
        $warning->getEvent(),
        $warning->getLevel(),
        $warning->getValidFrom()?->format('Y-m-d H:i'),
        $warning->getValidTo()?->format('Y-m-d H:i')
    );
}
```

### Meteorological warnings (`WarningsMeteo`)

[](#meteorological-warnings-warningsmeteo)

```
foreach ($client->warningsmeteo()->getWarnings() as $warning) {
    printf(
        "[%s] %s (level %d)\n",
        $warning->getOffice(),
        $warning->getEvent(),
        $warning->getLevel()
    );
}
```

Custom HTTP client
------------------

[](#custom-http-client)

`ImgwClient` optionally accepts a custom `HttpClientInterface` implementation - useful for plugging in a PSR-18 client with custom configuration (timeouts, headers, middleware) or for testing.

```
use Reynevan\Imgw\Http\HttpClientInterface;
use Reynevan\Imgw\Http\PsrHttpClientAdapter;
use Reynevan\Imgw\ImgwClient;

$httpClient = new PsrHttpClientAdapter($myPsr18Client, $myPsr17RequestFactory);
$client = new ImgwClient($httpClient);
```

Error handling
--------------

[](#error-handling)

Connection errors and API responses with a status &gt;= 400 are thrown as `Reynevan\Imgw\Exceptions\ImgwApiException`.

```
use Reynevan\Imgw\Exceptions\ImgwApiException;

try {
    $station = $client->synop()->getWeatherStationById(999999);
} catch (ImgwApiException $e) {
    // e.g. the station doesn't exist or the API is unavailable
}
```

Testing
-------

[](#testing)

```
composer test              # run the unit tests
composer test-coverage     # console coverage report
composer test-coverage-html # HTML coverage report in build/coverage
composer phpstan           # static analysis
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6200427?v=4)[Paweł](/maintainers/reynevan)[@reynevan](https://github.com/reynevan)

---

Top Contributors

[![reynevan](https://avatars.githubusercontent.com/u/6200427?v=4)](https://github.com/reynevan "reynevan (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/reynevan-imgw-php/health.svg)

```
[![Health](https://phpackages.com/badges/reynevan-imgw-php/health.svg)](https://phpackages.com/packages/reynevan-imgw-php)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k29.9M348](/packages/openai-php-client)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M59](/packages/getbrevo-brevo-php)[anthropic-ai/sdk

Anthropic PHP SDK

174884.4k25](/packages/anthropic-ai-sdk)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9082.3k](/packages/n1ebieski-ksef-php-client)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
