Air pollution has become a serious problem these days. Several countries have been racing to create multiple systems to prevent further air pollution.
This library can help developers to get realtime data on air quality in various worlds of various types.
To install this library, make sure you have composer installed.
Run the following command
composer require khumam/air-pollution ^1.0
Then call the data with the code below
<?php
require_once './vendor/autoload.php';
$get = new \AirPollution\AirPollution('API-KEY');
$get->searchByCity('Jakarta');
getResult($format)
Get all result. Default is JSON format, you can set to ARRAY.getCity($format)
Get city detail. Default is JSON format, also you can set to ARRAY.getDominant()
Get dominan pollutan.getAqi($pollutan)
Get Air Quality Index (AQI). Default is you can get all pollutan quality index, but you can also set spesific pollutan type. Available pollutan typeO3, PM10, PM25, UVI
getTime()
Get time.getForecast($pollutan)
You can get the next 7 days forecast of all pollutan, or you can spesific one.
You can get the API-KEY from https://aqicn.org/. Register using your email.
Yes, you can help optimize this library by contributing. All contributions are very meaningful to this library.