{"id":15068631,"url":"https://github.com/azuyalabs/waqi","last_synced_at":"2025-04-13T08:18:46.743Z","repository":{"id":44966982,"uuid":"81889057","full_name":"azuyalabs/waqi","owner":"azuyalabs","description":"Simple PHP Wrapper for the World Air Quality Index API","archived":false,"fork":false,"pushed_at":"2025-04-02T12:22:01.000Z","size":184,"stargazers_count":22,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-13T08:18:39.412Z","etag":null,"topics":["air-quality","api","api-wrapper","monitoring-station","php","php-library","php8","pm25","pollution","pollution-level","waqi"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azuyalabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.buymeacoffee.com/sachatelgenhof"}},"created_at":"2017-02-14T01:08:27.000Z","updated_at":"2025-04-02T12:18:44.000Z","dependencies_parsed_at":"2022-09-22T14:46:13.832Z","dependency_job_id":"496b603f-d92b-4879-b817-93a9a97fa677","html_url":"https://github.com/azuyalabs/waqi","commit_stats":{"total_commits":165,"total_committers":4,"mean_commits":41.25,"dds":0.4121212121212121,"last_synced_commit":"b73ff68512c6e6bb7378a98b42f32e9947dc3789"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuyalabs%2Fwaqi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuyalabs%2Fwaqi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuyalabs%2Fwaqi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azuyalabs%2Fwaqi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azuyalabs","download_url":"https://codeload.github.com/azuyalabs/waqi/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681549,"owners_count":21144705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["air-quality","api","api-wrapper","monitoring-station","php","php-library","php8","pm25","pollution","pollution-level","waqi"],"created_at":"2024-09-25T01:38:37.929Z","updated_at":"2025-04-13T08:18:46.737Z","avatar_url":"https://github.com/azuyalabs.png","language":"PHP","funding_links":["https://www.buymeacoffee.com/sachatelgenhof"],"categories":[],"sub_categories":[],"readme":"[![GitHub Release](https://img.shields.io/github/release/azuyalabs/waqi.svg?style=flat-square)](https://github.com/azuyalabs/waqi/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![CodeCheck](https://github.com/azuyalabs/waqi/workflows/Validate/badge.svg)](https://github.com/azuyalabs/waqi/actions)\n\n# PHP WAQI\n\nSimple PHP Wrapper for the World Air Quality Index API\n\n## Introduction\n\nThe [World Air Quality Index](http://waqi.info) project is an initiative to map the current and real-time air quality\naround the globe. The Air Quality indexes are based on PM2.5, PM10, Ozone, NO2, SO2 and CO hourly measurements provided\nby various monitoring stations in the world.\n\nThis package makes it easy to retrieve the Air Quality Index for your area and is based on the real-time Air Quality\ndata feed (API) of the WAQI project.\n\nNote: To make use of this package (and the underlying AQI API) an access token is required. You can acquire your token\nhere: [https://aqicn.org/data-platform/token](https://aqicn.org/data-platform/tokeni).\n\n## System Requirements\n\nYou need _PHP \u003e= 8.2_ to use `azuyalabs/waqi`.\n\n## Installation\n\nYou can pull in this package via composer:\n\n```shell\ncomposer require azuyalabs/waqi\n```\n\n## Usage\n\nStart by including the Composer `autoload` file in your project:\n\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n```\n\nUsing your AQI access token, create an instance of the WAQI object:\n\n```php\nuse Azuyalabs\\WAQI\\WAQI;\n\n$waqi = new WAQI(\u003cyour access token\u003e);\n```\n\nNext, use the `getObservationByStation` method with the desired city or monitoring station name (e.g.\n'new york'). This will obtain the latest air quality observations:\n\n```php\n$waqi-\u003egetObservationByStation('new york');\n```\n\n### Air Quality\n\nIf all goes well, use the various API methods to get details about the retrieved Air Quality Index of the chosen city or\nmonitoring station.\n\nTo get the AQI (Air Quality Index), use the method `getAQI`:\n\n```php\n$waqi-\u003egetAQI();\n```\n\nThis returns an array structure containing the Air Quality Index measured at this monitoring station at the time of\nmeasurement. It contains 4 elements:\n\n- 'aqi': the AQI level (which is defined by the monitoring station's dominant pollution type)\n- 'pollution_level': a narrative describing the air pollution level\n- 'health_implications': a narrative describing the health implications associated with the measured pollution level\n- 'cautionary_statement': a cautionary statement associated with the measured pollution level (only for PM2.5)\n\nExample output (for 'New York'):\n\n```shell\n - 'aqi': 15\n - 'pollution_level': Good\n - 'health_implications': Air quality is considered satisfactory, and air pollution poses little or no risk.\n - 'cautionary_statement': None\n```\n\nIn addition to the general Air Quality Information, specific pollutant level information is available as well. Be aware\nthat not every monitoring station captures all pollutant types, so some of these API functions may return 'null'.\n\nThe following API functions are available to get specific pollutant level information:\n\n- `getCO()`: returns the carbon monoxide (CO) level measured at the monitoring station at the time of measurement.\n- `getNO2()`: returns the nitrogen dioxide (NO2) level measured at the monitoring station at the time of measurement.\n- `getO3()`: returns the ozone (O3) level measured at the monitoring station at the time of measurement.\n- `getSO2()`: returns the sulfur dioxide (SO2) level measured at the monitoring station at the time of measurement.\n- `getPM10()`: returns the level of particulate matter 10 micrometers or lower (PM10), measured at this monitoring\n  station at the time of measurement.\n- `getPM25()`: returns the level of particulate matter 2.5 micrometers or lower (PM2.5), measured at this monitoring\n  station at the time of measurement.\n\n### Monitoring Station\n\nInformation about the monitoring station can be obtained through two API methods.\n\nFirst, using the API method `getMonitoringStation()`, will return information about the given monitoring station:\n\n- 'id': the unique ID for this monitoring station\n- 'name': the name (or description) of this monitoring station\n- 'coordinates': the geographical coordinates of this monitoring station (array of 'longitude' and 'latitude')\n- 'url': the URL of this monitoring station\n\nSecondly, the API method `getAttributions()` will return a list of EPA attributions for this monitoring station.\n\n### Other\n\nOther API methods that provide additional information, are:\n\n- `getMeasurementTime()`: returns the date/time the last measurement was taken. (as a `DateTime` object).\n- `getHumidity()`: returns the humidity (in %) measured at this monitoring station at the time of measurement.\n- `getTemperature()`: returns the temperature (in degrees Celsius) measured at this monitoring station at the time of\n  measurement.\n- `getPressure()`: returns the barometric pressure (in millibars) measured at this monitoring station at the time of\n  measurement.\n- `getPrimaryPollutant()`: returns the name of the primary pollutant at this monitoring station at the time of\n  measurement (e.g. 'pm25').\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information about what has changed.\n\n## Testing\n\nThis package comes with a [PHPUnit](https://phpunit.de) test suite. To run the tests, run the following command from the\nproject directory:\n\n```shell\ncomposer test\n```\n\n,or alternatively run with:\n\n```shell\nvendor/bin/phpunit\n```\n\n## Contributing\n\nContributions are encouraged and welcome; I am always happy to get feedback or pull requests on GitHub :)\nCreate [GitHub Issues](https://github.com/azuyalabs/waqi/issues) for bugs and new features and comment on the ones you\nare interested in.\n\nIf you enjoy what I am making, an extra cup of coffee is very much appreciated :). Your support helps me to put more\ntime into Open-Source Software projects like this.\n\n\u003ca href=\"https://www.buymeacoffee.com/sachatelgenhof\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n\n## License\n\nThis project is open-sourced software licensed under the MIT License (MIT). Please see [LICENSE](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuyalabs%2Fwaqi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuyalabs%2Fwaqi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuyalabs%2Fwaqi/lists"}