jhonoryza/laravel-prayertime 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jhonoryza/laravel-prayertime

最新稳定版本:1.2.2

Composer 安装命令:

composer require jhonoryza/laravel-prayertime

包简介

README 文档

README

Total Downloads Latest Stable Version License

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

  1. manual calculation : reference from prayertimes.org

  2. crawling bimasislam kemenag website https://bimasislam.kemenag.go.id/jadwalshalat

  3. 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

see Manual Calculation

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.

统计信息

  • 总下载量: 237
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-12