meezaan / prayer-times
1.0.5
2019-03-20 15:10 UTC
Requires (Dev)
- phpunit/phpunit: ^6.2
README
此库现在已废弃,推荐使用 https://github.com/islamic-network/prayer-times。
祈祷时间库(PHP)
这是由PrayTimes.org的Hamid Zarrabi-Zadeh用JavaScript编写的祈祷时间库(v2.3)的PHP版本,并在http://praytimes.org/code/v2/js/PrayTimes.js上可用。自从它首次编写以来,它与原始版本有很多不同,因此请勿将其用作“相同”的替代品——方法名称等很多内容都不同。
如何使用此库
此库是composer包,因此要安装它,请运行
composer require meezaan/prayer-times
使用它相当简单
<?php use Meezaan\PrayerTimes\PrayerTimes; // Instantiate the class with your chosen method, Juristic School for Asr and if you want or own Asr factor, make the juristic school null and pass your own Asr shadow factor as the third parameter. Note that all parameters are optional. $pt = new PrayerTimes('ISNA'); // new PrayerTimes($method, $asrJuristicMethod, $asrShadowFactor); // Then, to get times for today. $times = $pt->getTimesForToday($latitude, $longitude, $timezone, $elevation = null, $latitudeAdjustmentMethod = self::LATITUDE_ADJUSTMENT_METHOD_ANGLE, $midnightMode = self::MIDNIGHT_MODE_STANDARD, $format = self::TIME_FORMAT_24H); // Or, if you want times for another day $times = $pt->getTimes(DateTime $date, $latitude, $longitude, $elevation = null, $latitudeAdjustmentMethod = self::LATITUDE_ADJUSTMENT_METHOD_ANGLE, $midnightMode = self::MIDNIGHT_MODE_STANDARD, $format = self::TIME_FORMAT_24H); //If you would like to offset the time for each result by a particular number of minutes, simply call the tune method before calling getTimes or getTimesForToday. $pt->tune($imsak = 0, $fajr= 0, $sunrise = 0, $dhuhr = 0, $asr = 0, $maghrib = 0, $sunset = 0, $isha = 0, $midnight = 0); // Finally, you can also create your own methods: $method = new Method('My Custom Method'); $method->setFajrAngle(18); $method->setMaghribAngleOrMins(19.5); $method->setIshaAngleOrMins('90 min'); // And then: $pt = new PrayerTimes(PrayerTimes::METHOD_CUSTOM); $pt->setCustomMethod($method); // And then the same as before: $times = $pt->getTimesForToday($latitude, $longitude, $timezone, $elevation = null, $latitudeAdjustmentMethod = self::LATITUDE_ADJUSTMENT_METHOD_ANGLE, $midnightMode = self::MIDNIGHT_MODE_STANDARD, $format = self::TIME_FORMAT_24H);
方法
目前支持以下方法
理解方法
关于方法的讨论,请参见(即将提供的URL)。
测试
比较此库生成的结果与原始JS版本。
贡献者
Hamid Zarrabi-Zadeh,Meezaan-ud-Din Abdu Dhil-Jalali Wal-Ikram
许可证
与原始版本相同 - 许可证:GNU LGPL v3.0,这意味着
Permission is granted to use this code, with or without modification, in any website or application provided that credit is given to the original work with a link back to PrayTimes.org.