2017 © Pedro Peláez
 

library darksky-php

A PHP wrapper for the DarkSky developer API

image

epochblue/darksky-php

A PHP wrapper for the DarkSky developer API

  • Friday, December 12, 2014
  • by epochblue
  • Repository
  • 1 Watchers
  • 7 Stars
  • 91 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

darksky-php

NOTE: This API wrapper is for an old version of the API and has been superseded. This library is no longer maintained., (*1)

A simple PHP wrapper for interacting with the DarkSky API., (*2)

Requirements

  • PHP 5.2.0+
  • a DarkSky API key

Installation

Installing darksky-php is simple, and it is recommended that you use Composer to use it in your project. If you're new to Composer, please see the Composer website for more information on what Composer is and how to use it. Once you have your project set up to use Composer, to include darksky-php, add the following to your composer.json file:, (*3)

{
    "require": {
        "epochblue/darksky-php": "dev-master"
    }
}

With that added, run a php composer.phar update epochblue/darksky-php from your project root, and you're ready to go., (*4)

Usage

All the public methods in the darksky-php wrapper return associative arrays. Below is an example of all the public methods available via this API wrapper. Please refer to the DarkSky API Documentation for more details about the return values., (*5)

<?php
// Creates an instance of the API wrapper.
$darksky = new DarkSky('<YOUR API KEY HERE>');

// Returns a forecast for the next hour at a specific location
$forecast = $darksky->getForecast(36.126617, -86.842756);

// Returns a (slightly more brief) forecast for the next hour at a specific location
$brief_forecast = $darksky->getBriefForecast(36.126617, -86.842756);

// Returns forecasts for given locations at specific points in time
// NOTE: the 'time' array key is optional. If it's not included, the current time will be used.
$precipitation  = $darksky->getPrecipitation(
    array(
        'lat'  => 36.126617,
        'long' => -86.842756,
        'time' => 1350612061
    ),
    array(
        'lat'  => 36.126617,
        'long' => -86.842756,
        'time' => 1350600061
    ),
    array(
        'lat'  => 36.126617,
        'long' => -86.842756
    )
);

// Returns a list of interesting storms going on at this moment
$interesting = $darksky->getInterestingStorms();

Author

Bill Israel - https://github.com/epochblue - @epochblue, (*6)

Copyright (c) 2012 Bill Israel. See the included LICENSE file for further details., (*7)

The Versions

12/12 2014

dev-master

9999999-dev https://www.github.com/epochblue/darksky-php

A PHP wrapper for the DarkSky developer API

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

api weather darksky dark sky

22/10 2012

v1.0.0

1.0.0.0 https://www.github.com/epochblue/darksky-php

A PHP wrapper for the DarkSky developer API

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

api weather darksky dark sky