承接 moay/opensensemap-api-php-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

moay/opensensemap-api-php-client

Composer 安装命令:

composer require moay/opensensemap-api-php-client

包简介

A client for retrieving sensor data from a senseBox from the opensensemap api

README 文档

README

travis-ci-status

opensensemap-api-php-client

A lightweight client for retrieving sensor data from a senseBox from the opensensemap api.

This is not an official project from the senseBox team.

Setup

Install via composer:

composer require moay/opensensemap-api-php-client

Usage

Take a look at the implementation example in the directory example.

$client = OpensensemapApiClientFactory::create();

// Change senseBox id
$senseBoxData = $client->getSenseBoxData('someSenseBoxId');

foreach ($senseBoxData as $sensorValue) {
    // $sensorValue->getValueType()
    // $sensorValue->getValue()
    // $sensorValue->getUnit()
    // $sensorValue->getSensorType()
    // $sensorValue->getMeasurementTime()->format('Y-m-d H:i:s')
}

You don't have to iterate over all values, just use this handy function:

$temperature = $senseBoxData->getValueByType(SensorValue::TYPE_TEMPERATURE);

Outputting values can be done directly by casting the values to strings:

echo 'Temperature: '.$temperature; // Output: Temperature: 12 °C
echo $temperature; // Output: 12 °C
$temperatureString = (string) $temperature // $temperatureString = '12 °C' 

Features

The client gives you the latest data for a specific senseBox from the OpenSenseMap Api.

As there was no need for further features, none have been implemented. This could easily be done, though. Feel free to submit a PR.

License

The client is published under the MIT license.

senseBox and all related contents, visuals and brands are published under CC licenses or other public domain licenses. Make sure to check out the project.

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固