2017 © Pedro Peláez
 

library laravel-dark-sky

Provides a Wrapper for the DarkSky API

image

naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  • Thursday, March 22, 2018
  • by Holiehandgrenade
  • Repository
  • 2 Watchers
  • 7 Stars
  • 8,087 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 11 Versions
  • 25 % Grown

The README.md

Laravel DarkSky

Latest Stable Version Software License Total Downloads, (*1)

This provides a Laravel style wrapper for the DarkSky api. For more information regarding request and response formats, visit: https://darksky.net/dev/docs, (*2)

Install

Require this package with composer using the following command:, (*3)

``` bash $ composer require naughtonium/laravel-dark-sky, (*4)



After updating composer, add the service provider to the `providers` array in `config/app.php` ```php Naughtonium\LaravelDarkSky\LaravelDarkSkyServiceProvider::class,

To register a facade accessor, add the following to config/app.php aliases array, (*5)

'DarkSky' => \Naughtonium\LaravelDarkSky\Facades\DarkSky::class,

Configuration

Add the following line to the .env file:, (*6)

DARKSKY_API_KEY=<your_darksky_api_key>

Usage

For full details of response formats, visit: https://darksky.net/dev/docs/response, (*7)

Required

location(lat, lon)

Pass in latitude and longitude coordinates for a basic response ``` php DarkSky::location(lat, lon)->get();, (*8)

#### Optional Parameters
For full details of optional parameters, visit: https://darksky.net/dev/docs/forecast

##### excludes([]) / includes([])
Specify which data blocks to exclude/include to reduce data transfer
```php
DarkSky::location(lat, lon)->excludes(['minutely','hourly', 'daily', 'alerts', 'flags'])->get();
DarkSky::location(lat, lon)->includes(['currently'])->get();
// Same output
atTime(t)

Pass in a unix timestamp to get forecast for that time. Note: the timezone is relative to the given location, (*9)

``` php DarkSky::location(lat, lon)->atTime(timestamp)->get();, (*10)

##### language(l)
Specify a language for text based responses
``` php
DarkSky::location(lat, lon)->language(lang)->get();
units(u)

Specify units for unit based responses ``` php DarkSky::location(lat, lon)->units(units)->get();, (*11)

##### extend()
Extend the "hourly" response from 48 to 168 hours.
Note: Does not work if used with an atTime() timestamp.
Please see: https://darksky.net/dev/docs/time-machine
``` php
DarkSky::location(lat, lon)->extend()->get();

Helpers

The following are shorthand helpers to add readability equal to using includes() with only one parameter. Note: only one may be used per query and only temperature specific data is returned, (*12)

->currently()
->minutely()
->hourly()
->daily()
->flags()

For example, these two statements are the same, (*13)

DarkSky::location(lat, lon)->hourly()
DarkSky::location(lat, lon)->includes(['hourly'])->get()->hourly

Credits

License

The MIT License (MIT). Please see License File for more information., (*14)

The Versions

22/03 2018

dev-master

9999999-dev https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

22/03 2018

1.2.5

1.2.5.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

22/03 2018

1.2.4

1.2.4.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

20/09 2017

1.2.3

1.2.3.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

13/07 2017

1.2.2

1.2.2.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

22/06 2017

1.2.1

1.2.1.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

20/06 2017

1.2.0

1.2.0.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

18/06 2017

1.1.1

1.1.1.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

18/06 2017

1.1.0

1.1.0.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

18/06 2017

1.0.1

1.0.1.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky

14/06 2017

1.0.0

1.0.0.0 https://github.com/naughtonium/laravel-dark-sky

Provides a Wrapper for the DarkSky API

  Sources   Download

MIT

The Requires

 

The Development Requires

naughtonium laravel-dark-sky