PHP code example of dmitry-ivanov / dark-sky-api

1. Go to this page and download the library: Download dmitry-ivanov/dark-sky-api 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/ */

    

dmitry-ivanov / dark-sky-api example snippets


    use DmitryIvanov\DarkSkyApi\DarkSkyApi;

    $forecast = (new DarkSkyApi('secret-key'))
        ->location(46.482, 30.723)
        ->forecast('daily');

    echo $forecast->daily()->summary();
    

$timeMachine = (new DarkSkyApi('secret-key'))
    ->location(46.482, 30.723)
    ->timeMachine('2020-01-01', 'daily');

echo $timeMachine->daily()->summary();

$timeMachine = (new DarkSkyApi('secret-key'))
    ->location(46.482, 30.723)
    ->timeMachine(['2020-01-01', '2020-01-02', '2020-01-03'], 'daily');

echo $timeMachine['2020-01-02']->daily()->summary();

    use DarkSkyApi;

    $forecast = DarkSkyApi::location(46.482, 30.723)
        ->forecast('daily');

    echo $forecast->daily()->summary();
    
shell script
    php artisan vendor:publish --provider="DmitryIvanov\DarkSkyApi\Adapters\Laravel\DarkSkyApiServiceProvider"