定制 islamic-network/ilm-api-base 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

islamic-network/ilm-api-base

Composer 安装命令:

composer require islamic-network/ilm-api-base

包简介

Shared serving runtime for the ilm domain APIs: snapshot repository, DTO utilities, response cache, base controller and search scanner.

README 文档

README

The shared serving runtime for the ilm domain APIs (pray, events, people, quotes, stories). A domain API built on this package ships only what makes it that domain: its DTO classes (which ARE its contract), its Corpus (joins and projections), its controllers and routes. Everything domain-blind lives here:

  • Snapshot\Repository — polls snapshots/manifest.json in the ilm bucket, loads the domain's snapshot file into worker memory when the version changes, maps it strictly into the domain's snapshot DTOs (drift throws; the last good version keeps serving), and constructs the domain Corpus. Configured via kipchak.snapshot: connection, bucket, prefix, refresh, plus the domain key and the Document/Corpus class names.
  • Snapshot\CorpusInterface — what a domain corpus must expose (its snapshot version); constructor convention ($document, $version).
  • Utils\Dto — strict valinor mapping in, array normalization out, with the contracts' "empty values are omitted" null-stripping (keepNulls for the exceptions).
  • Utils\Hijri — Gregorian → Hijri via the AlAdhan API (islamic-network/sdk IslamicCalendarClient, pinned to HJCoSA): the authoritative, sighting-adjusted date. Conversions are worker-memoized and disk-cached for a day; if AlAdhan is unreachable on a cold cache, ext-intl's tabular islamic-civil answers as a logged fallback. ALADHAN_API_URL overrides the endpoint.
  • Middlewares\ResponseCache — disk cache for 200 GET responses (Kipchak filecache driver); keys carry the snapshot version so publishes invalidate naturally and a pod restart is a full flush.
  • Controllers\SnapshotControllerwithCorpus() (503 on a cold worker), pagination, and the paginated meta envelope via Kipchak's Response::json.
  • Search\Scanner — the diacritic-folded search mechanism: query tokenization (folded exactly like the sync-time search blobs), AND-token matching, and per-field matched_in computation. Field maps per record type stay in each domain's Corpus.
  • DataTransferObjects\Prose — the {raw, html} prose rendition shape every contract shares.

Wiring a domain API

// config/kipchak.snapshot.php
return [
    'connection' => 'ilm',
    'bucket' => env('S3_BUCKET', 'ilm'),
    'prefix' => env('SNAPSHOT_PREFIX', 'snapshots'),
    'refresh' => (int) env('SNAPSHOT_REFRESH', '60'),
    'domain' => 'pray',                          // key in the manifest files map
    'document' => Snapshot\Document::class,      // strict-mapped snapshot DTO
    'corpus' => Snapshot\Corpus::class,          // implements CorpusInterface
];

Controllers extend SnapshotController; Middlewares\ResponseCache is added in the app's global middleware stack before Kipchak's Error middleware.

pray-api is the reference consumer.

Developing

composer install
vendor/bin/phpunit

PHP 8.4+ (all ilm code stays 8.4-compatible), kipchak/core 3.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固