PHP code example of lawnstarter / laravel-darksky

1. Go to this page and download the library: Download lawnstarter/laravel-darksky library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lawnstarter / laravel-darksky example snippets


Lawnstarter\LaravelDarkSky\LaravelDarkSkyServiceProvider::class,

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

DarkSky::location(lat, lon)->excludes(['minutely','hourly', 'daily', 'alerts', 'flags'])->get();
DarkSky::location(lat, lon)->

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

DarkSky::location(lat, lon)->hourly()
DarkSky::location(lat, lon)->

DarkSky::setTestResponse($testResponseValue);



use Lawnstarter\LaravelDarkSky\DarkSkySampleResponse;
use Lawnstarter\LaravelDarkSky\DarkSky;

class MyTestsDependOnDarksky extends TestCase {

    public function test_forecast() {
        ...
        $fakeForecast = DarkSkySampleResponse::forecast();
        DarkSky::setTestResponse($fakeForecast);
        ...
    }

    public function test_forecast_extended_hourly() {
        ...
        $fakeForecast = DarkSkySampleResponse::forecastExtendedHourly();
        DarkSky::setTestResponse($fakeForecast);
        ...
    }

    public function test_timemachine() {
        ...
        $fakeForecast = DarkSkySampleResponse::timemachine();
        DarkSky::setTestResponse($fakeForecast);
        ...
    }

}

 php
DarkSky::location(lat, lon)->get();
 php
DarkSky::location(lat, lon)->atTime(timestamp)->get();
 php
DarkSky::location(lat, lon)->language(lang)->get();
 php
DarkSky::location(lat, lon)->units(units)->get();
 php
DarkSky::location(lat, lon)->extend()->get();