PHPackages                             russelomua/aqi-calculator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. russelomua/aqi-calculator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

russelomua/aqi-calculator
=========================

description

2.0(2y ago)3745MITPHPPHP ^8.1CI failing

Since May 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/russelomua/AirQualityCalculator)[ Packagist](https://packagist.org/packages/russelomua/aqi-calculator)[ RSS](/packages/russelomua-aqi-calculator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (2)Versions (4)Used By (0)

AirQualityCalculator v2
=======================

[](#airqualitycalculator-v2)

[![Version](https://camo.githubusercontent.com/c0a95541f9eca6028c8af8412132bdfd8b789e285160e383f028a99ad52d1c9e/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f76657273696f6e)](https://camo.githubusercontent.com/c0a95541f9eca6028c8af8412132bdfd8b789e285160e383f028a99ad52d1c9e/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f76657273696f6e)[![Dependents](https://camo.githubusercontent.com/2cf6b55c0ee979c0d308fb2e8544da8d2edc6f85ac2a4df4b3c6784643305ca1/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f646570656e64656e7473)](https://camo.githubusercontent.com/2cf6b55c0ee979c0d308fb2e8544da8d2edc6f85ac2a4df4b3c6784643305ca1/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f646570656e64656e7473)[![PHP Version Require](https://camo.githubusercontent.com/ff4174d408e4ab68a566bc1e002eda36cc9e0f0b257eeaaaeaaad13d6eed60c8/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f726571756972652f706870)](https://camo.githubusercontent.com/ff4174d408e4ab68a566bc1e002eda36cc9e0f0b257eeaaaeaaad13d6eed60c8/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f726571756972652f706870)[![License](https://camo.githubusercontent.com/2f940df806a238d4c7af867d25b898c7b56f68cb3b222e693b9c33adf332a599/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f6c6963656e7365)](https://camo.githubusercontent.com/2f940df806a238d4c7af867d25b898c7b56f68cb3b222e693b9c33adf332a599/687474703a2f2f706f7365722e707567782e6f72672f72757373656c6f6d75612f6171692d63616c63756c61746f722f6c6963656e7365)[![Codacy Badge](https://camo.githubusercontent.com/3ae1f9ff2568635df897838273662429471a20ae6a2461205a68488fdfa8674f/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6361323664343733663533643433326138636231626434653832646665323336)](https://app.codacy.com/manual/russelomua/AirQualityCalculator?utm_source=github.com&utm_medium=referral&utm_content=russelomua/AirQualityCalculator&utm_campaign=Badge_Grade_Dashboard)[![Coverage Badge](https://raw.githubusercontent.com/russelomua/AirQualityCalculator/image-data/coverage.svg)](https://raw.githubusercontent.com/russelomua/AirQualityCalculator/image-data/coverage.svg)

Air Quality Index Calculator - is a tool for calculating Air Quality Index for PM2.5, PM19, CO, SO2, NO2, O3 (ozone)

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

[](#installation)

```
composer require russelomua/aqi-calculator
```

Upgrading from v1
-----------------

[](#upgrading-from-v1)

Now require PHP 8.1 or higher Fully incompatible with v1, see Usage section for more details

Usage
-----

[](#usage)

```
// Must contains min 2 values of measurements
// good to use 12 or 24 values for PM25 and PM10
$concentrations = [13, 16, 10, 21, 74, 64, 53, 82, 90, 75, 80, 50];

$nowCast = new \AirQuality\NowCast($concentrations);

// NowCast value only
echo $nowCast->getValue();

$pollutant = new \AirQuality\Pollutants\PM25Pollutant();
$calculator = $nowCast->createCalculator($pollutant);

// Full quality object
$quality = $calculator->getQuality();
// Index only quality object
$index = $calculator->getIndex();

// NowCast
echo $quality->nowCast;

// AQI
echo $quality->index->value;

// AQI category enum
// has methods for getting category name and color
echo $quality->index->category?->value;
echo $quality->index->category?->getName();
echo $quality->index->category?->getHexColor();

// Or all together
var_dump($quality->jsonSerialize());
```

References
----------

[](#references)

- [Reference calculator](https://www3.epa.gov/airnow/aqicalctest/nowcast.htm)
- [Technical Assistance Document for the Reporting of Daily Air Quality](https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf)
- [Communicating Daily and Real-time Air Quality with the Air Quality Index and the NowCast](http://airnowtech.org/Resources/NACAANowCastPresentation.pdf)
- [NowCast](https://cran.r-project.org/web/packages/PWFSLSmoke/vignettes/NowCast.html)
- [Transitioning to a new NowCast Method](https://www3.epa.gov/airnow/ani/pm25_aqi_reporting_nowcast_overview.pdf)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% 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 ~575 days

Total

3

Last Release

1078d ago

Major Versions

1.0.2 → 2.02023-07-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/313658?v=4)[Mykola Kliashtornyi](/maintainers/russelomua)[@russelomua](https://github.com/russelomua)

---

Top Contributors

[![russelomua](https://avatars.githubusercontent.com/u/313658?v=4)](https://github.com/russelomua "russelomua (28 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/russelomua-aqi-calculator/health.svg)

```
[![Health](https://phpackages.com/badges/russelomua-aqi-calculator/health.svg)](https://phpackages.com/packages/russelomua-aqi-calculator)
```

###  Alternatives

[sroze/argument-resolver

A lightweight utility to resolve method arguments based on types and names

1042.9k1](/packages/sroze-argument-resolver)

PHPackages © 2026

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