composer require jhonoryza/laravel-prayertime
run migration
php artisan migrate
this will create 3 tables: provinces, cities and prayertimes table
publish config file
php artisan vendor:publish --tag=prayertime-config
you can choose from one of this source by configuring config file prayertime.php
-
manual calculation : reference from prayertimes.org
-
crawling bimasislam kemenag website https://bimasislam.kemenag.go.id/jadwalshalat
-
api from myquran.com (sebelumnya domain https://api.banghasan.com/)
get city data from the source and save it to the database
php artisan pray:sync-city
get prayer times from the source and save it to the database
php artisan pray:sync-times
public function getPrayerTimes(string $provinceId, string $cityId, int $month, int $year): array
example :
<?php
Route::get('/time', function (PrayerTime $prayer) {
$prayerTimes = $prayer->getPrayerTimes(
provinceId: '', // Kab Bandung province external id for manual calculation or when using kemenag use this c20ad4d76fe97759aa27a0c99bff6710
cityId: '3204', // Kab Bandung external id for manual calculation or when using kemenag use this 0777d5c17d4066b82ab86dff8a46af6f
month: 6,
year: 2024
);
foreach ($prayerTimes as $index => $times) {
foreach ($times as $key => $prayerTime) {
if (in_array($key, ['city_external_id', 'prayer_at'])) {
continue;
}
$times[$key] = $prayerTime->format('H:i');
}
$prayerTimes[$index] = $times;
}
return response()->json([
'data' => $prayerTimes,
]);
});
If you've found a bug regarding security please mail jardik.oryza@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.