Download the PHP package lawnstarter/laravel-darksky without Composer
On this page you can find all versions of the php package lawnstarter/laravel-darksky. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lawnstarter/laravel-darksky
More information about lawnstarter/laravel-darksky
Files in lawnstarter/laravel-darksky
Package laravel-darksky
Short Description Provides a Wrapper for the DarkSky API
License MIT
Homepage https://github.com/lawnstarter/laravel-darksky
Informations about the package laravel-darksky
Laravel DarkSky
This provides a Laravel style wrapper for the DarkSky api and simplifies writing tests against ever changing weather data. For more information regarding request and response formats, visit: https://darksky.net/dev/docs
Install
Require this package with composer using the following command:
After updating composer, add the service provider to the providers
array in config/app.php
To register a facade accessor, add the following to config/app.php
aliases
array
Configuration
Add the following line to the .env file:
Usage
For full details of response formats, visit: https://darksky.net/dev/docs/response
Required
location(lat, lon)
Pass in latitude and longitude coordinates for a basic response
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
atTime(t)
Pass in a unix timestamp to get forecast for that time. Note: the timezone is relative to the given location
language(l)
Specify a language for text based responses
units(u)
Specify units for unit based responses
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
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
For example, these two statements are the same
DarkSky & Testing
To simplyfiy testing the static method to force the response to be a certain payload without actually hitting the DarkSky API was added.
When this value is not null, the DarkSky wrapper will always return this data. If the value is null, the DarkSky API will be queried in real-time. To simplify testing further, sample test responses are available for you to use in your test classes
Method | Sample Payload |
---|---|
See Sample Forecast JSON | |
See Sample Forecast Extended Hourly JSON | |
See Sample Time Machine JSON |
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-darksky with dependencies
guzzlehttp/guzzle Version ~5.3|>=6.0
illuminate/support Version ~5.3|>=6.0