addapp/breezometer-php

Breezometer 的 PHP 客户端包

1.0 2015-04-02 07:38 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:14:54 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

A PHP client package for the Breezometer API.

想在 Laravel 应用中使用这个包吗?请查看 Breezometer-Laravel 包。

安装

通过 Composer

$ composer require addapp/breezometer-php

用法

$breezometer = new \Addapp\Breezometer\Breezometer('your_api_key');

$info = $breezometer->baqi('40.7324296', '-73.9977264');
// or
$info = $breezometer->baqi('40.7324296', '-73.9977264', '2015-06-17T11:11:21');
// or
$info = $breezometer->baqiFromLocation('New+York');
// or
$info = $breezometer->baqiFromLocation('New+York', '2015-06-17T11:11:21');

将返回类似以下内容

{
   "country_name" :  "USA",
   "breezometer_aqi" :  49,
   "breezometer_color" :  "#FFF900",
   "breezometer_description" :  "Moderate Air Quality",
   "country_aqi" :  78,
   "country_color" :  "#FFF700",
   "country_description" :  "Moderate Air Quality",
   "data_valid" : true,
   "key_valid" : true,
   "random_recommendations" : {
         "children" :  "Pay attention to the respiratory status of your kid(s)",
         "sport" :  "You want to work out now??!… Only if you have no plan B",
         "health" :  "People with health sensitivities should be prepared for minor respiratory difficulties",
         "inside" :  "We're not going to tell you not to go outside, but you should continue tracking the air quality around you",
         "outside" :  "If you wish to stay outside for a long time, you should try to find a cleaner place nearby"
         },
   "dominant_pollutant_canonical_name" :  "nox",
   "dominant_pollutant_text" : {
         "main" :  "At the moment, nitrogen oxides (NOx) are the main pollutant in the air.",
         "effects" :  "Exposure may cause increased bronchial reactivity in patients with asthma, lung function decline in patients with COPD and increased risk of respiratory infections, especially in young children.",
         "causes" :  "Main sources are fuel burning processes in industry and transportation."
         }
}

测试

$ phpunit

贡献

请参阅 CONTRIBUTING 以获取详细信息。

致谢

许可

MIT 许可证(MIT)。请参阅 许可文件 以获取更多信息。