PHP code example of islamic-network / prayer-times
1. Go to this page and download the library: Download islamic-network/prayer-times library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
islamic-network / prayer-times example snippets
slamicNetwork\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);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.