minube / solar-position
Solar Position PHP Library for sunset, sunrise, twilight phases time calculation.
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 11
Forks: 1
Open Issues: 0
pkg:composer/minube/solar-position
This package is not auto-updated.
Last update: 2025-09-28 09:45:33 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
- UTC DateTime object
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 ) */