定制 crumbls/astrology 二次开发

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

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

crumbls/astrology

Composer 安装命令:

composer require crumbls/astrology

包简介

Internal Laravel package: natal chart engine (tropical + Vedic) with interactive D3 renderer, built on Swiss Ephemeris.

README 文档

README

Internal Laravel package: natal chart engine (tropical Western + sidereal Vedic) with an interactive D3 chart renderer. Built on Swiss Ephemeris via jayeshmepani/swiss-ephemeris-ffi. Verified against Cafe Astrology and swetest to the arcsecond.

Install

composer require crumbls/astrology
php artisan swisseph:install

swisseph:install downloads the three required .se1 data files and builds the swetest binary (macOS or Linux). It's idempotent — re-running with no --force only fetches what's missing.

Then enable PHP FFI in your environment:

  • Herd / Valet: open Herd → PHP → INI tab → add ffi.enable=true → save (auto-restarts FPM).
  • CLI works without changes (CLI defaults to ffi.enable=preload which still permits FFI from CLI).

Usage

use Crumbls\Astrology\Services\NatalChartService;

$svc = app(NatalChartService::class);
$birth = new DateTimeImmutable('1984-04-19 05:00:00', new DateTimeZone('UTC'));

$chart = $svc->chart($birth, latitude: 38.31667, longitude: -107.78333);
// Returns: birth, mode, ayanamsa, ascendant, midheaven, vertex,
//          part_of_fortune, planets, houses, placidus_cusps, aspects.

For a Vedic chart (with nakshatras, padas, Vimshottari dashas):

$chart = $svc->chart($birth, 38.31667, -107.78333, NatalChartService::MODE_SIDEREAL);

Demo page

Visit /astro/chart for an interactive D3 chart wheel with hover tooltips, aspect line highlighting, and a form to compute new charts. Disable with ASTROLOGY_DEMO_ROUTE=false.

CLI

php artisan astro:chart "1984-04-19 05:00:00" --lat=38.31667 --lng=-107.78333 --tz=UTC
php artisan astro:chart "1990-05-15 14:30:00" --lat=40.7128 --lng=-74.0060 --json

Caching

Chart results are cached via Cache::rememberForever() keyed on (UTC timestamp, lat, lng, mode). First call ~2ms; subsequent reads ~0.2ms. Use ASTROLOGY_CACHE_STORE=redis (or any cache store name) to override the default store.

Roadmap

  • SynastryService — cross-aspects between two charts
  • CompositeService — midpoint composite charts
  • AshtakootaService — Vedic Guna Milan (36-point matrimonial compatibility)
  • Pluggable interpretation-content store

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固