jhonoryza / laravel-prayertime
1.1.2
2024-07-15 14:44 UTC
Requires
- php: ^8.2
- geniusts/prayer-times: ^1.0
- guzzlehttp/guzzle: ^7.8
- illuminate/support: ^10.0
- islamic-network/prayer-times: ^1.0
- symfony/dom-crawler: ^7.0
Requires (Dev)
- laravel/pint: ^1.14
- orchestra/testbench: ^8.18
README
install
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
sources
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/)
sync predefined city and province data
get city data from the source and save it to the database
php artisan pray:sync-city
sync prayer times
get prayer times from the source and save it to the database
php artisan pray:sync-times
general usage
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, ]); });
manual calculation usage
Security
If you've found a bug regarding security please mail jardik.oryza@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.