This library has been written for the AlAdhan.com API @ https://aladhan.com/prayer-times-api and is included in the main prayer times library @ https://github.com/islamic-network/prayer-times.
- PHP 7.3+
composer install islamic-network/prayer-times-moonsighting
To calculate Fajr minutes before sunrise:
use IslamicNetwork\MoonSighting\Fajr;
use DateTime;
$date = new DateTime('24-12-2020');
$pt = new Fajr($date, 25.2119894);
$pt->getMinutesBeforeSunrise(); // 88 minutes
To calculate Isha minutes after sunset:
use IslamicNetwork\MoonSighting\Fajr;
use DateTime;
$date = new DateTime('24-12-2020');
$pt = new Isha($date, 25.2119894, 'general'); // The third parameter is shafaq, acceptable values for which are 'general', 'ahmer', 'abyad'.
$pt->getMinutesAfterSunset(); // 86 minutes
To run unit tests, from the root of this repository execute:
vendor/bin/phpunit tests/Unit/
Syed Khalid Shaukat, who has done the research for this method of computing timings for higher latitude areas. For more information about the calculation, please see the Fajr and Isha booklet @ https://github.com/islamic-network/prayer-times-moonsighting/blob/master/booklet-fajr-isha.pdf and visit https://www.moonsighting.com/.