PHP code example of ko / ambient-weather

1. Go to this page and download the library: Download ko/ambient-weather library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ko / ambient-weather example snippets


composer 

  $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-api-key-here');
  $AWSettings->setApplicationKey('your-application-key-here');
  $AWSettings->setInterval(5);
  $AWSettings->setTimeframe(4);
  $AWSettings->setDevice('device-mac-address');

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


  date_default_timezone_set("America/New_York");

  cheSettings->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);