Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Latest commit

 

History

History
executable file
·
48 lines (42 loc) · 2.58 KB

README.md

File metadata and controls

executable file
·
48 lines (42 loc) · 2.58 KB

Darksky

A simple wrapper for Dark Sky API

Latest Stable Version Build Status Build Status Maintainability Test Coverage Code Coverage Scrutinizer Code Quality Issue Count License StyleCI Codacy Badge Packagist GitHub license

Server Requirements

  • PHP >= 7.0.0

Usage

  • Get the API key from https://darksky.net/dev
  • Install this package in your project:
    composer require darksky/darksky
  • To forecast:
use Darksky\Darksky;

try {
    $result = (new Darksky('API_KEY'))->forecast('LAT', 'LONG');
} catch(DarkskyException $e) {
    // handle the exception
} catch(Exception $e) {
    // handle the exception
}
  • To use the time machine:
use Darksky\Darksky;

try {
    $result = (new Darksky('API_KEY'))->timeMachine('LAT', 'LONG', 'UNIX_TIME');
} catch(DarkskyException $e) {
    // handle the exception
} catch(Exception $e) {
    // handle the exception
}