PHPackages                             fyennyi/alerts-in-ua-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. fyennyi/alerts-in-ua-php

ActiveLibrary

fyennyi/alerts-in-ua-php
========================

PHP client library for the alerts.in.ua API.

v0.3.3(3mo ago)3211LicenseRef-CSSM-Unlimited-2.0PHPPHP &gt;=8.1CI passing

Since Apr 12Pushed 3mo agoCompare

[ Source](https://github.com/Fyennyi/alerts-in-ua-php)[ Packagist](https://packagist.org/packages/fyennyi/alerts-in-ua-php)[ Fund](https://opencollective.com/cssm)[ Patreon](https://www.patreon.com/ChernegaSergiy)[ RSS](/packages/fyennyi-alerts-in-ua-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (27)Used By (0)

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)

API Client for alerts.in.ua in PHP
==================================

[](#api-client-for-alertsinua-in-php)

[![Latest Stable Version](https://camo.githubusercontent.com/fbb8595b1842b3566733796debdf7fb2295a5be60be655a7f580c96cff91afd7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6679656e6e79692f616c657274732d696e2d75612d7068702e7376673f6c6162656c3d5061636b6167697374266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/alerts-in-ua-php)[![Total Downloads](https://camo.githubusercontent.com/85518e33295b015d10c728a0805706db478a8cf2176bd036068055d926fe22a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6679656e6e79692f616c657274732d696e2d75612d7068702e7376673f6c6162656c3d446f776e6c6f616473266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/alerts-in-ua-php)[![License](https://camo.githubusercontent.com/b96bd029dd512ff1a714343feabc436bc89f424a90bbd6d84b7479b8703d9dda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6679656e6e79692f616c657274732d696e2d75612d7068702e7376673f6c6162656c3d4c6963656e6365266c6f676f3d6f70656e2d736f757263652d696e6974696174697665)](https://packagist.org/packages/fyennyi/alerts-in-ua-php)[![Tests](https://camo.githubusercontent.com/bd34b2a3af10367eb668faefaa906cf9c8ca490b26330cc2f2b9aaf33da8be77/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f616c657274732d696e2d75612d7068702f706870756e69742e796d6c3f6c6162656c3d5465737473266c6f676f3d676974687562)](https://github.com/Fyennyi/alerts-in-ua-php/actions/workflows/phpunit.yml)[![Test Coverage](https://camo.githubusercontent.com/5491dc4c4dcfe28282d49c08c9249eed245db25d3dc04f04bad78a06d284d2b2/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4679656e6e79692f616c657274732d696e2d75612d7068703f6c6162656c3d54657374253230436f766572616765266c6f676f3d636f6465636f76)](https://app.codecov.io/gh/Fyennyi/alerts-in-ua-php)[![Static Analysis](https://camo.githubusercontent.com/89d4ebc5b1bd8a12e4fef281a35a2358932335a66c8b6e9ecc186fa91419615b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f616c657274732d696e2d75612d7068702f7068707374616e2e796d6c3f6c6162656c3d5048505374616e266c6f676f3d676974687562)](https://github.com/Fyennyi/alerts-in-ua-php/actions/workflows/phpstan.yml)

The API client for alerts.in.ua is a PHP library that simplifies access to the alerts.in.ua API service. It provides real-time information about air raid alerts in Ukraine. The library supports asynchronous operations, making it easy to integrate with various applications and services.

Note

This unofficial library may not fully support the official alerts.in.ua API and is still in early development, so expect changes or instability.

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

[](#installation)

To install the API Client for alerts.in.ua in PHP, run the following command in your terminal:

```
composer require fyennyi/alerts-in-ua-php
```

Usage
-----

[](#usage)

⚠️ Before you can use this library, you need to obtain an API token by visiting [devs.alerts.in.ua](https://devs.alerts.in.ua/).

### Basic Setup

[](#basic-setup)

First, create a client instance with your API token and an optional PSR-16 cache instance:

```
require 'vendor/autoload.php';

use Fyennyi\AlertsInUa\Client\AlertsClient;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;

$cache = new Psr16Cache(new FilesystemAdapter()); // Or any other PSR-16 cache
$client = new AlertsClient('your_token', $cache);
```

### Getting Active Alerts

[](#getting-active-alerts)

Here's how to fetch and display all currently active alerts:

```
try {
    $alerts = $client->getActiveAlertsAsync()->wait();

    echo 'Active alerts: ' . count($alerts->getAllAlerts()) . "\n";

    foreach ($alerts->getAllAlerts() as $alert) {
        echo "{$alert->getAlertType()->value} in {$alert->getLocationTitle()}\n";
    }
} catch (\Throwable $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

### Getting Alerts History

[](#getting-alerts-history)

To retrieve historical alert data for a specific region:

```
try {
    $history = $client->getAlertsHistoryAsync('Харківська область', 'month_ago')->wait();

    echo "\nAlerts history for Kharkiv Oblast: " . count($history->getAllAlerts()) . "\n";

    foreach ($history->getAllAlerts() as $alert) {
        $status = $alert->isFinished() ? 'Finished' : 'Active';
        echo "{$alert->getAlertType()->value} in {$alert->getLocationTitle()} - {$status}\n";
    }
} catch (\Throwable $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

### Getting Air Raid Alert Statuses

[](#getting-air-raid-alert-statuses)

To check the current status of air raid alerts across all oblasts:

```
try {
    $statuses = $client->getAirRaidAlertStatusesByOblastAsync()->wait();

    echo "\nAir raid alert statuses by oblast:\n";

    foreach ($statuses->getStatuses() as $status) {
        echo "{$status->getOblast()}: {$status->getStatus()}\n";
    }
} catch (\Throwable $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

### Getting Detailed Air Raid Alert Statuses

[](#getting-detailed-air-raid-alert-statuses)

To retrieve a detailed list of all air raid alert statuses, including community-level alerts:

```
try {
    $statuses = $client->getAirRaidAlertStatusesAsync()->wait();

    echo "\nDetailed air raid alert statuses:\n";

    foreach ($statuses->getStatuses() as $status) {
        echo "{$status->getLocationTitle()}: {$status->getStatus()}\n";
    }
} catch (\Throwable $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

### Filtering Alerts

[](#filtering-alerts)

The library provides convenient methods to filter alerts by type and location:

```
try {
    $alerts = $client->getActiveAlertsAsync()->wait();

    // Get only air raid alerts
    $air_raid_alerts = $alerts->getAirRaidAlerts();
    echo "\nAir raid alerts: " . count($air_raid_alerts) . "\n";

    // Get only oblast-level alerts
    $oblast_alerts = $alerts->getOblastAlerts();
    echo "Oblast-level alerts: " . count($oblast_alerts) . "\n";

    // Get alerts for a specific oblast
    $kharkiv_alerts = $alerts->getAlertsByOblast('Харківська область');
    echo "Kharkiv Oblast alerts: " . count($kharkiv_alerts) . "\n";

} catch (\Throwable $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

### Exporting to XML

[](#exporting-to-xml)

All models and collections can be exported to XML format:

```
// Export a single alert
echo $alert->toXml('alert');

// Export all active alerts
echo $alerts->toXml('alerts');
```

Asynchronous Operations
-----------------------

[](#asynchronous-operations)

The library supports asynchronous operations for better performance when handling multiple requests. You can run multiple API calls concurrently without blocking execution.

### Fetching Multiple Alerts Concurrently

[](#fetching-multiple-alerts-concurrently)

You can start multiple requests and handle them all together without blocking:

```
use GuzzleHttp\Promise\Utils;

$promises = [
    'active' => $client->getActiveAlertsAsync(),
    'history' => $client->getAlertsHistoryAsync('Харківська область', 'month_ago'),
];

Utils::all($promises)->then(function ($results) {
    $alerts = $results['active'];
    $history = $results['history'];

    echo "Active alerts: " . count($alerts->getAllAlerts()) . "\n";
    foreach ($alerts->getAllAlerts() as $alert) {
        echo "{$alert->getAlertType()} in {$alert->getLocationTitle()}\n";
    }

    echo "\nHistory for Kharkiv Oblast:\n";
    foreach ($history->getAllAlerts() as $alert) {
        $status = $alert->isFinished() ? 'Finished' : 'Active';
        echo "{$alert->getAlertType()} in {$alert->getLocationTitle()} - {$status}\n";
    }
})->wait();
```

### Checking Air Raid Alert Statuses Concurrently

[](#checking-air-raid-alert-statuses-concurrently)

You can also query multiple oblasts or summary data at the same time:

```
$promises = [
    'kyiv_status' => $client->getAirRaidAlertStatusAsync('Київська область', true),
    'all_statuses' => $client->getAirRaidAlertStatusesByOblastAsync(),
];

Utils::all($promises)->then(function ($results) {
    $kyiv_status = $results['kyiv_status'];
    $all_statuses = $results['all_statuses'];

    echo "Kyiv Oblast air raid status: " . $kyiv_status->getStatus() . "\n";

    echo "\nAir raid alert statuses by oblast:\n";
    foreach ($all_statuses->getStatuses() as $status) {
        echo "{$status->getOblast()}: {$status->getStatus()}\n";
    }
})->wait();
```

### Filtering Alerts After Asynchronous Retrieval

[](#filtering-alerts-after-asynchronous-retrieval)

You can apply filters to the alerts once they are asynchronously retrieved:

```
$client->getActiveAlertsAsync()->then(function ($alerts) {
    $air_raid_alerts = $alerts->getAirRaidAlerts();
    $oblast_alerts = $alerts->getOblastAlerts();
    $kharkiv_alerts = $alerts->getAlertsByOblast('Харківська область');

    echo "Air raid alerts: " . count($air_raid_alerts) . "\n";
    echo "Oblast-level alerts: " . count($oblast_alerts) . "\n";
    echo "Kharkiv Oblast alerts: " . count($kharkiv_alerts) . "\n";
})->wait();
```

Tip

You can use `Utils::settle()` instead of `Utils::all()` if you want to gracefully handle individual request failures without throwing exceptions.

You can continue to use individual `->wait()` calls when needed, but using `Utils::all()` allows for better concurrency and performance when dealing with multiple requests.

Caching
-------

[](#caching)

This library uses PSR-16 compliant caching. You can inject any PSR-16 compatible cache adapter:

```
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Psr16Cache;

// Example with Filesystem cache
$filesystemCache = new Psr16Cache(new FilesystemAdapter());
$clientWithFilesystemCache = new AlertsClient('your_token', $filesystemCache);

// Example with Redis cache
$redisClient = new \Redis();
$redisClient->connect('localhost', 6379);
$redisCache = new Psr16Cache(new RedisAdapter($redisClient));
$clientWithRedisCache = new AlertsClient('your_token', $redisCache);

// Example with Memcached cache
$memcachedClient = new \Memcached();
$memcachedClient->addServer('localhost', 11211);
$memcachedCache = new Psr16Cache(new \Symfony\Component\Cache\Adapter\MemcachedAdapter($memcachedClient));
$clientWithMemcachedCache = new AlertsClient('your_token', $memcachedCache);

// Basic setup with default cache (if not provided, a no-op cache is used)
$client = new AlertsClient('your_token', $filesystemCache); // Or any other PSR-16 cache
```

The `AlertsClient` constructor now accepts an optional `Psr16Cache` instance as its second argument. If no cache is provided, a `NullCache` (a no-op cache) is used by default.

Many methods in `AlertsClient` also accept an optional `$use_cache` parameter. When set to `true`, the method will attempt to retrieve data from the cache before making an API request. If the data is not found in the cache, it will fetch it from the API and store it in the cache for future requests.

Methods
-------

[](#methods)

### AlertsClient

[](#alertsclient)

#### `getActiveAlertsAsync(bool $use_cache = false): Promise`

[](#getactivealertsasyncbool-use_cache--false-promisealerts)

Fetches a list of active alerts asynchronously.

- `$use_cache` – Whether to use cached data (default `false`).

---

#### `getAlertsHistoryAsync(string|int $oblast_uid_or_location_title, string $period = 'week_ago', bool $use_cache = false): Promise`

[](#getalertshistoryasyncstringint-oblast_uid_or_location_title-string-period--week_ago-bool-use_cache--false-promisealerts)

Fetches the alert history for a specific oblast or location.

- `$oblast_uid_or_location_title` – Oblast title or numeric UID.
- `$period` – Time period to retrieve alerts (e.g. `'month_ago'`, `'week_ago'`).
- `$use_cache` – Whether to use cached data (default `false`).

---

#### `getAirRaidAlertStatusAsync(string|int $oblast_uid_or_location_title, bool $oblast_level_only = false, bool $use_cache = false): Promise`

[](#getairraidalertstatusasyncstringint-oblast_uid_or_location_title-bool-oblast_level_only--false-bool-use_cache--false-promiseairraidalertoblaststatus)

Returns air raid alert status for one oblast.

- `$oblast_uid_or_location_title` – Oblast title or UID.
- `$oblast_level_only` – Only oblast-level alerts (default `false`).
- `$use_cache` – Use cache (default `false`).

---

#### `getAirRaidAlertStatusesByOblastAsync(bool $oblast_level_only = false, bool $use_cache = false): Promise`

[](#getairraidalertstatusesbyoblastasyncbool-oblast_level_only--false-bool-use_cache--false-promiseairraidalertoblaststatuses)

Returns air raid alert statuses across all oblasts.

- `$oblast_level_only` – Only oblast-level alerts (default `false`).
- `$use_cache` – Use cache (default `false`).

---

#### `getAirRaidAlertStatusesAsync(bool $use_cache = false): Promise`

[](#getairraidalertstatusesasyncbool-use_cache--false-promiseairraidalertstatuses)

Fetches a detailed list of all air raid alert statuses, including community-level alerts.

- `$use_cache` – Whether to use cached data (default `false`).

---

#### `getAlertsByCoordinatesAsync(float $lat, float $lon, string $period = 'week_ago', bool $use_cache = false): Promise`

[](#getalertsbycoordinatesasyncfloat-lat-float-lon-string-period--week_ago-bool-use_cache--false-promisealerts)

Fetches the alert history for the location at the given coordinates.

---

#### `getAirRaidAlertStatusByCoordinatesAsync(float $lat, float $lon, bool $oblast_level_only = false, bool $use_cache = false): Promise`

[](#getairraidalertstatusbycoordinatesasyncfloat-lat-float-lon-bool-oblast_level_only--false-bool-use_cache--false-promiseairraidalertoblaststatus)

Returns air raid alert status for the location at the given coordinates.

---

#### `getAirRaidAlertStatusByCoordinatesFromAllAsync(float $lat, float $lon, bool $use_cache = false): Promise`

[](#getairraidalertstatusbycoordinatesfromallasyncfloat-lat-float-lon-bool-use_cache--false-promiseairraidalertstatus)

Returns air raid alert status for the location at the given coordinates using the bulk status endpoint.

---

#### `setRequestInterval(int $seconds): void`

[](#setrequestintervalint-seconds-void)

Sets the minimum interval between identical API requests (default: 5 seconds). Use `0` to disable internal rate limiting (useful for tests).

---

Note

All async methods return a `GuzzleHttp\Promise\PromiseInterface`. To retrieve the final result, call `->wait()` on the promise.

### Alert

[](#alert)

Represents a single alert with its details.

#### `getId(): int`

[](#getid-int)

Returns the unique identifier of the alert.

#### `getLocationTitle(): string`

[](#getlocationtitle-string)

Returns the name of the location where the alert is active (e.g., `'Харківська область'`).

#### `getLocationType(): LocationType`

[](#getlocationtype-locationtype)

Returns the type of the location as a `LocationType` enum (e.g., `LocationType::OBLAST`).

#### `getStartedAt(): ?DateTimeInterface`

[](#getstartedat-datetimeinterface)

Returns the start time of the alert.

#### `getFinishedAt(): ?DateTimeInterface`

[](#getfinishedat-datetimeinterface)

Returns the end time of the alert, or `null` if it is still active.

#### `getUpdatedAt(): ?DateTimeInterface`

[](#getupdatedat-datetimeinterface)

Returns the time of the last update for the alert.

#### `getAlertType(): AlertType`

[](#getalerttype-alerttype)

Returns the type of the alert as an `AlertType` enum (e.g., `AlertType::AIR_RAID`).

#### `getLocationUid(): ?int`

[](#getlocationuid-int)

Returns the unique identifier (UID) of the location.

#### `getLocationOblast(): ?string`

[](#getlocationoblast-string)

Returns the name of the oblast where the location is.

#### `getLocationOblastUid(): ?int`

[](#getlocationoblastuid-int)

Returns the unique identifier (UID) of the oblast.

#### `getLocationRaion(): ?string`

[](#getlocationraion-string)

Returns the name of the raion where the location is.

#### `getNotes(): ?string`

[](#getnotes-string)

Returns additional notes for the alert.

#### `isCalculated(): bool`

[](#iscalculated-bool)

Returns `true` if the alert's end time was calculated automatically.

#### `isFinished(): bool`

[](#isfinished-bool)

Returns `true` if the alert has finished, or `false` if it is still active.

#### `isActive(): bool`

[](#isactive-bool)

Returns `true` if the alert is still active.

#### `getDuration(): ?DateInterval`

[](#getduration-dateinterval)

Returns the duration of the alert as a `DateInterval` object.

#### `getDurationInSeconds(): ?int`

[](#getdurationinseconds-int)

Returns the duration of the alert in seconds.

#### `__toString(): string`

[](#__tostring-string)

Returns a JSON representation of the alert.

---

### Alerts

[](#alerts)

A collection of `Alert` objects returned by `getActiveAlertsAsync()` and `getAlertsHistoryAsync()`. This object is iterable, so you can use it directly in a `foreach` loop.

#### `getAllAlerts(): Alert[]`

[](#getallalerts-alert)

Returns a plain array of all `Alert` objects in the collection.

#### `getAirRaidAlerts(): Alert[]`

[](#getairraidalerts-alert)

Filters the collection and returns only air raid alerts.

#### `getArtilleryShellingAlerts(): Alert[]`

[](#getartilleryshellingalerts-alert)

Returns a filtered list of artillery shelling alerts.

#### `getUrbanFightsAlerts(): Alert[]`

[](#geturbanfightsalerts-alert)

Returns a filtered list of urban fights alerts.

#### `getNuclearAlerts(): Alert[]`

[](#getnuclearalerts-alert)

Returns a filtered list of nuclear alerts.

#### `getChemicalAlerts(): Alert[]`

[](#getchemicalalerts-alert)

Returns a filtered list of chemical alerts.

#### `getOblastAlerts(): Alert[]`

[](#getoblastalerts-alert)

Filters the collection and returns only oblast-level alerts.

#### `getRaionAlerts(): Alert[]`

[](#getraionalerts-alert)

Returns a filtered list of raion-level alerts.

#### `getHromadaAlerts(): Alert[]`

[](#gethromadaalerts-alert)

Returns a filtered list of hromada-level alerts.

#### `getCityAlerts(): Alert[]`

[](#getcityalerts-alert)

Returns a filtered list of city-level alerts.

#### `getAlertsByAlertType(AlertType|string $alert_type): Alert[]`

[](#getalertsbyalerttypealerttypestring-alert_type-alert)

Filters the collection and returns only alerts of a specific type.

#### `getAlertsByLocationType(LocationType|string $location_type): Alert[]`

[](#getalertsbylocationtypelocationtypestring-location_type-alert)

Returns a filtered list of alerts for a specific location type.

#### `getAlertsByLocationTitle(string $location_title): Alert[]`

[](#getalertsbylocationtitlestring-location_title-alert)

Filters the collection and returns alerts for a specific location title.

#### `getAlertsByOblast(string $oblast_title): Alert[]`

[](#getalertsbyoblaststring-oblast_title-alert)

Filters the collection and returns alerts for a specific oblast.

- `$oblast_title` – The name of the oblast to filter by (e.g., `'Харківська область'`).

#### `getAlertsByLocationUid(int $location_uid): Alert[]`

[](#getalertsbylocationuidint-location_uid-alert)

Returns a filtered list of alerts for a specific location UID.

- `$location_uid` – The numeric UID of the location.

#### `getLastUpdatedAt(): ?DateTime`

[](#getlastupdatedat-datetime)

Returns the timestamp of the last update.

#### `getDisclaimer(): string`

[](#getdisclaimer-string)

Returns the disclaimer text provided with the alerts.

#### `count(): int`

[](#count-int)

Returns the total number of alerts in the collection.

#### `__toString(): string`

[](#__tostring-string-1)

Returns a JSON representation of the entire alerts collection.

---

### AirRaidAlertOblastStatus

[](#airraidalertoblaststatus)

Represents the alert status for a single oblast.

#### `getOblast(): string`

[](#getoblast-string)

Returns the name of the oblast.

#### `getStatus(): AlertStatus`

[](#getstatus-alertstatus)

Returns the current alert status for the oblast as an `AlertStatus` enum (e.g., `AlertStatus::ACTIVE`).

#### `isActive(): bool`

[](#isactive-bool-1)

Returns `true` if the entire oblast has an active alert.

#### `isPartlyActive(): bool`

[](#ispartlyactive-bool)

Returns `true` if only part of the oblast has an active alert.

#### `isNoAlert(): bool`

[](#isnoalert-bool)

Returns `true` if there are no active alerts in the oblast.

#### `__toString(): string`

[](#__tostring-string-2)

Returns a JSON representation of the oblast status.

---

### AirRaidAlertOblastStatuses

[](#airraidalertoblaststatuses)

A collection of `AirRaidAlertOblastStatus` objects, returned by `getAirRaidAlertStatusesByOblastAsync()`. This object is iterable.

#### `getStatuses(): AirRaidAlertOblastStatus[]`

[](#getstatuses-airraidalertoblaststatus)

Returns a plain array of `AirRaidAlertOblastStatus` objects.

#### `filterByStatus(AlertStatus|string $status): AirRaidAlertOblastStatus[]`

[](#filterbystatusalertstatusstring-status-airraidalertoblaststatus)

Returns a filtered list of oblast status objects by specific status.

#### `getActiveAlertOblasts(): AirRaidAlertOblastStatus[]`

[](#getactivealertoblasts-airraidalertoblaststatus)

Returns a filtered list of oblasts with an `active` status.

#### `getPartlyActiveAlertOblasts(): AirRaidAlertOblastStatus[]`

[](#getpartlyactivealertoblasts-airraidalertoblaststatus)

Returns a filtered list of oblasts with a `partly` active status.

#### `getNoAlertOblasts(): AirRaidAlertOblastStatus[]`

[](#getnoalertoblasts-airraidalertoblaststatus)

Returns a filtered list of oblasts with `no_alert` status.

#### `count(): int`

[](#count-int-1)

Returns the total number of oblasts in the collection.

#### `__toString(): string`

[](#__tostring-string-3)

Returns a JSON representation of the oblast statuses collection.

---

### AirRaidAlertStatus

[](#airraidalertstatus)

Represents the alert status for a single location.

#### `getLocationTitle(): string`

[](#getlocationtitle-string-1)

Returns the name of the location.

#### `getStatus(): AlertStatus`

[](#getstatus-alertstatus-1)

Returns the current alert status for the location as an `AlertStatus` enum (e.g., `AlertStatus::ACTIVE`).

#### `getUid(): ?int`

[](#getuid-int)

Returns the unique identifier (UID) of the location.

#### `isActive(): bool`

[](#isactive-bool-2)

Returns `true` if the location has an active alert.

#### `isPartlyActive(): bool`

[](#ispartlyactive-bool-1)

Returns `true` if the location has a partly active alert.

#### `isNoAlert(): bool`

[](#isnoalert-bool-1)

Returns `true` if the location has no active alerts.

#### `__toString(): string`

[](#__tostring-string-4)

Returns a JSON representation of the location status.

---

### AirRaidAlertStatuses

[](#airraidalertstatuses)

A collection of `AirRaidAlertStatus` objects, returned by `getAirRaidAlertStatusesAsync()`. This object is iterable and allows array access.

#### `getActiveAlertStatuses(): AirRaidAlertStatus[]`

[](#getactivealertstatuses-airraidalertstatus)

Returns a filtered list of statuses with an `active` status.

#### `filterByStatus(AlertStatus|string $status): AirRaidAlertStatus[]`

[](#filterbystatusalertstatusstring-status-airraidalertstatus)

Returns a filtered list of status objects by specific status.

#### `getPartlyActiveAlertStatuses(): AirRaidAlertStatus[]`

[](#getpartlyactivealertstatuses-airraidalertstatus)

Returns a filtered list of statuses with a `partly` active status.

#### `getNoAlertStatuses(): AirRaidAlertStatus[]`

[](#getnoalertstatuses-airraidalertstatus)

Returns a filtered list of statuses with a `no_alert` status.

#### `getStatus(int $uid): ?AirRaidAlertStatus`

[](#getstatusint-uid-airraidalertstatus)

Returns a single `AirRaidAlertStatus` for a specific location UID.

- `$uid` – The numeric UID of the location.

#### `count(): int`

[](#count-int-2)

Returns the total number of statuses in the collection.

#### `__toString(): string`

[](#__tostring-string-5)

Returns a JSON representation of the statuses collection.

Districts and Regions (UIDs)
----------------------------

[](#districts-and-regions-uids)

[Open the table](https://docs.google.com/spreadsheets/u/0/d/1XnTOzcPHd1LZUrarR1Fk43FUyl8Ae6a6M7pcwDRjNdA/htmlview#)

UIDName13Івано-Франківська область68Івано-Франківський район67Верховинський район71Калуський район70Коломийський район69Косівський район72Надвірнянський район29Автономна Республіка Крим8Волинська область38Володимирський район41Камінь-Каширський район40Ковельський район39Луцький район4Вінницька область36Вінницький район37Гайсинський район35Жмеринський район33Могилів-Подільський район32Тульчинський район34Хмільницький район9Дніпропетровська область44Дніпровський район42Кам'янський район46Криворізький район47Нікопольський район45Павлоградський район43Самарівський район48Синельниківський район28Донецька область54Бахмутський район55Волноваський район51Горлівський район53Донецький район49Кальміуський район50Краматорський район52Маріупольський район56Покровський район10Житомирська область57Бердичівський район59Житомирський район60Звягельський район58Коростенський район11Закарпатська область61Берегівський район65Мукачівський район63Рахівський район64Тячівський район66Ужгородський район62Хустський район12Запорізька область564м. Запоріжжя147Бердянський район146Василівський район149Запорізький район148Мелітопольський район145Пологівський район14Київська область78Бориспільський район79Броварський район75Бучанський район73Білоцерківський район74Вишгородський район76Обухівський район77Фастівський район15Кіровоградська область82Голованівський район81Кропивницький район83Новоукраїнський район80Олександрійський район16Луганська область85Сватівський район86Старобільський район84Сіверськодонецький район87Щастинський район27Львівська область91Дрогобицький район94Золочівський район90Львівський район88Самбірський район89Стрийський район92Шептицький район93Яворівський район17Миколаївська область96Баштанський район95Вознесенський район98Миколаївський район97Первомайський район18Одеська область101Ізмаїльський район100Березівський район105Болградський район102Білгород-Дністровський район104Одеський район99Подільський район103Роздільнянський район19Полтавська область107Кременчуцький район106Лубенський район108Миргородський район109Полтавський район5Рівненська область110Вараський район111Дубенський район112Рівненський район113Сарненський район20Сумська область117Конотопський район118Охтирський район116Роменський район114Сумський район115Шосткинський район21Тернопільська область120Кременецький район119Тернопільський район121Чортківський район22Харківська область1293м. Харків125Ізюмський район127Берестинський район126Богодухівський район123Куп'янський район128Лозівський район124Харківський район122Чугуївський район23Херсонська область129Бериславський район133Генічеський район131Каховський район130Скадовський район132Херсонський район3Хмельницька область135Кам'янець-Подільський район134Хмельницький район136Шепетівський район24Черкаська область150Звенигородський район153Золотоніський район151Уманський район152Черкаський район26Чернівецька область138Вижницький район139Дністровський район137Чернівецький район25Чернігівська область144Корюківський район141Новгород-Сіверський район142Ніжинський район143Прилуцький район140Чернігівський район31м. КиївContributing
------------

[](#contributing)

Contributions are welcome and appreciated! Here's how you can contribute:

1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Please make sure to update tests as appropriate and adhere to the existing coding style.

License
-------

[](#license)

This library is licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2). See the [LICENSE](LICENSE) file for details.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance80

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.9% 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

Every ~12 days

Recently: every ~21 days

Total

24

Last Release

109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2471bdadcf4a5ea969fe763a72d03fb46525b59a7e4cedc3ed4d855029e7785?d=identicon)[ChernegaSergiy](/maintainers/ChernegaSergiy)

---

Top Contributors

[![ChernegaSergiy](https://avatars.githubusercontent.com/u/60980650?v=4)](https://github.com/ChernegaSergiy "ChernegaSergiy (943 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

air-raid-alertsapi-clientasyncphpphp-libraryphp8ukraineukraine-invasion

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fyennyi-alerts-in-ua-php/health.svg)

```
[![Health](https://phpackages.com/badges/fyennyi-alerts-in-ua-php/health.svg)](https://phpackages.com/packages/fyennyi-alerts-in-ua-php)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[commercetools/commercetools-sdk

The official PHP SDK for the commercetools Composable Commerce APIs

19281.5k](/packages/commercetools-commercetools-sdk)

PHPackages © 2026

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