islamic-network/prayer-times-moonsighting

基于 moonsighting.com 计算日出前 Fajr 和日落后 Isha 时间的 PHP 祈祷时间库

1.1 2020-07-22 06:16 UTC

This package is auto-updated.

Last update: 2024-08-27 21:13:15 UTC


README

Releases CI

基于 MoonSighting.com 的 PHP 库计算 Fajr 和 Isha 时间

此库是为 AlAdhan.com API 编写的 https://aladhan.com/prayer-times-api,并包含在主祈祷时间库中 https://github.com/islamic-network/prayer-times

要求

  • PHP 7.3+

安装

composer install islamic-network/prayer-times-moonsighting

使用

计算日出前 Fajr 分钟

use IslamicNetwork\MoonSighting\Fajr;
use DateTime;

$date = new DateTime('24-12-2020');
$pt = new Fajr($date, 25.2119894);
$pt->getMinutesBeforeSunrise(); // 88 minutes

计算日落后 Isha 分钟

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

测试

要运行单元测试,从本仓库的根目录执行

vendor/bin/phpunit tests/Unit/

致谢

Syed Khalid Shaukat,他为此方法在较高纬度地区计算时间进行了研究。有关计算的更多信息,请参阅 Fajr 和 Isha 小册子 https://github.com/islamic-network/prayer-times-moonsighting/blob/master/booklet-fajr-isha.pdf 并访问 https://www.moonsighting.com/