承接 ko/ambient-weather 相关项目开发

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

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

ko/ambient-weather

Composer 安装命令:

composer require ko/ambient-weather

包简介

A PHP SDK for interacting with the ambient weather api to retrieve data and draw canvas visualizations

README 文档

README

This module is built for interacting with the ambientweather.net API. It utilizes the ko\json-cache module to reduce pressure on the ambient weather API and to provide a faster load time for the weather station data.

Demo

Weather Data Demo

Install

composer require ko/ambient-weather

Properties

Property Type Description
apiKey String Your ambient weather API Key
applicationKey String Your ambient weather API Applicaiton Key
interval Integer The reporting interval of your weather station
timeframe Integer The ammount of time into the past to fetch data for
device String The MAC address of your weather station

Usage

Build the cache

Build the cache settings object

  $KOCacheSettings = new \KO\Cache\Settings();
  $KOCacheSettings->setValidity(15);
  $KOCacheSettings->setFile('data_cache.json');

Instantiate a new cache object with the settings

  $KOCache = new \KO\Cache\Cache($KOCacheSettings);

Build the AmbientWeather object

Build the AmbientWeather settings object

  $AWSettings = new \KO\AmbientWeather\Settings();
  $AWSettings->setApiKey('your-api-key-here');
  $AWSettings->setApplicationKey('your-application-key-here');
  $AWSettings->setInterval(5);
  $AWSettings->setTimeframe(4);
  $AWSettings->setDevice('device-mac-address');

Instantiate a new AmbientWeather object with the settings

  $AW = new \KO\AmbientWeather\AmbientWeather($AWSettings, $KOCache);

Charts

new KO\AmbientWeather\Charts\Wind($AW);
new KO\AmbientWeather\Charts\Temperature($AW);
new KO\AmbientWeather\Charts\Barometric($AW);

Gauges

KO\AmbientWeather\Gauges\WindDirection($AW);
KO\AmbientWeather\Gauges\WindSpeed($AW);

Complete Example

<?php
  date_default_timezone_set("America/New_York");

  require("vendor/autoload.php");
  
  $KOCacheSettings = new \KO\Cache\Settings();
  $KOCacheSettings->setValidity(15);
  $KOCacheSettings->setFile('data_cache.json');

  $KOCache = new \KO\Cache\Cache($KOCacheSettings);

  $AWSettings = new \KO\AmbientWeather\Settings();
  $AWSettings->setApiKey('your-key-here');
  $AWSettings->setApplicationKey('your-key-here');
  $AWSettings->setInterval(5);
  $AWSettings->setTimeframe(1);
  $AWSettings->setDevice('your-MAC-here');

  $AW = new \KO\AmbientWeather\AmbientWeather($AWSettings, $KOCache);

?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Document</title>

    <script
      src="https://code.jquery.com/jquery-3.3.1.min.js"
      integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
      crossorigin="anonymous"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>

    <script src="//cdn.rawgit.com/Mikhus/canvas-gauges/gh-pages/download/2.1.4/all/gauge.min.js"></script>
  </head>
  <body>

    <?php
        new KO\AmbientWeather\Charts\Wind($AW);
        new KO\AmbientWeather\Charts\Temperature($AW);
        new KO\AmbientWeather\Charts\Barometric($AW);
        new KO\AmbientWeather\Gauges\WindDirection($AW);
        new KO\AmbientWeather\Gauges\WindSpeed($AW);
    ?>

  </body>
</html>

Documentation

See the full Documentation for more details.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固