crumbls / astrology
Internal Laravel package: natal chart engine (tropical + Vedic) with interactive D3 renderer, built on Swiss Ephemeris.
Requires
- php: ^8.3
- jayeshmepani/swiss-ephemeris-ffi: ^1.1
- laravel/framework: ^12.0 || ^13.0
Requires (Dev)
- laravel/pint: ^1.27
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.0
- rector/rector: ^2.3
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=preloadwhich 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 chartsCompositeService— midpoint composite chartsAshtakootaService— Vedic Guna Milan (36-point matrimonial compatibility)- Pluggable interpretation-content store