2017 © Pedro Peláez
 

library phpdarksky

PhpDarkSky is a simple wrapper for making requests to the dark sky api - https://darksky.net/dev

image

davidwofford/phpdarksky

PhpDarkSky is a simple wrapper for making requests to the dark sky api - https://darksky.net/dev

  • Thursday, January 4, 2018
  • by davidwofford
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHP Dark Sky

A simple wrapper for connecting to and pulling information from the Dark Sky api, (*1)

Features

  • An easy to use wrapper for connecting to the dark sky api to get weather data
  • Methods to get filtered down data instead of 1 massive blob

Notes

  • All data is returned as associative arrays
  • Errors from the Dark Sky api are returned as exceptions

Requirements

Installation

Composer

To install through composer add the following line to your composer.json file:, (*2)

    "require": {
        "davidwofford/phpdarksky": "1.1.*"
    }

or run this command, (*3)

    composer require davidwofford/phpdarksky

Copy

If you do not wish to use composer, copy the PhpDarkSky directory to your library / vendor folder and add:, (*4)

    include "[vendor / library directory]/phpdarksky/src/PhpDarkSky.php";

Usage

Get the forecast

To get all of the forecast data for a location, (*5)

    $darkSky = new PhpDarkSky('[API KEY]', '[LATITUDE]', '[LONGITUDE]');

    try {
        $foreacast = $darkSky->getForecast();
    } catch (\Exception $e) {
        // Handle the exception
    }

Get the current forecast only

This will return data that would be in the currently array from getForecast, (*6)

    $darkSky = new PhpDarkSky('[API KEY]', '[LATITUDE]', '[LONGITUDE]');

    try {
        $foreacast = $darkSky->getCurrentForecast();
    } catch (\Exception $e) {
        // Handle the exception
    }

There is a similar function for all of the other arrays that appear in getForecast as well., (*7)

Get the time machine data

To get the time machine data for a location, (*8)

    $darkSky = new PhpDarkSky('[API KEY]', '[LATITUDE]', '[LONGITUDE]');

    try {
        $foreacast = $darkSky->getTimeMachine('[UNIX TIMESTAMP]');
    } catch (\Exception $e) {
        // Handle the exception
    }

As with the forecast items above there is a method to get filtered down arrays for each of the array items that appear from this call as well., (*9)

Configuration

If you are having issues with your ssl cert being denied locally you can add this define in your project to bypass the ssl cert check., (*10)

define('PHP_DARK_SKY_BYPASS_SSL', true);, (*11)

DO NOT TURN THIS ON IN PRODUCTION, (*12)

Resources

The Versions

04/01 2018

dev-master

9999999-dev https://github.com/davidwofford/PhpDarkSky

PhpDarkSky is a simple wrapper for making requests to the dark sky api - https://darksky.net/dev

  Sources   Download

MIT

The Requires

  • php ^7.0

 

by David Wofford

api dark sky

04/01 2018

1.0.0

1.0.0.0 https://github.com/davidwofford/PhpDarkSky

PhpDarkSky is a simple wrapper for making requests to the dark sky api - https://darksky.net/dev

  Sources   Download

MIT

The Requires

  • php ^7.0

 

by David Wofford

api dark sky