PHP code example of minube / solar-position

1. Go to this page and download the library: Download minube/solar-position 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/ */

    

minube / solar-position example snippets


    use SolarPosition\Calculator;

    $latitude = 40.433202;
    $longitude = -3.690161;
    $date = array('day'=>23, 'month'=>6, 'year'=>2017);

    $sun = new Calculator();
    $sunsetTime = $sun->getSunset($date, $latitude,$longitude);
    /*
        DateTime Object
        (
            [date] => 2017-06-23 19:48:35
            [timezone_type] => 3
            [timezone] => UTC
        )
    */