minube/solar-position

There is no license information available for the latest version (1.0.0) of this package.

Solar Position PHP Library for sunset, sunrise, twilight phases time calculation.

1.0.0 2017-08-31 10:14 UTC

This package is not auto-updated.

Last update: 2024-05-12 02:20:38 UTC


README

Calculate the sunset and sunrise times for a particular location and date, as well as the different twilight phases (civil, nautical, astronomical) times. More details about the different sun position phases in timeanddate.com.

Input

  • Date: array('day', 'month', 'year')
  • Latitude
  • Longitude

Output

Example

    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
        )
    */