Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Jpl Moshier Ephemeris Php

Jpl Moshier Ephemeris Php Laravel Package

jayeshmepani/jpl-moshier-ephemeris-php

PHP 8.3+ FFI wrapper for the JPL Moshier Ephemeris C library, exposing all 204 jme_* functions and native JME_* constants. Supports JPL, Moshier, and VSOP87/ELP2000/Meeus engines with no hidden rounding or output reshaping. Requires ext-ffi and a compiled libjme shared library.

View on GitHub
Deep Wiki
Context7

PHP FFI wrapper for the JPL Moshier Ephemeris native library with JME API, runtime binaries, and JPL kernel support.

Frequently asked questions about Jpl Moshier Ephemeris Php
How do I install jayeshmepani/jpl-moshier-ephemeris-php in a Laravel application?
Install it with Composer by running composer require jayeshmepani/jpl-moshier-ephemeris-php on PHP 8.3 or newer with the ext-ffi extension enabled. The package ships prebuilt native binaries under its libs/ directory for linux-x64, macOS arm64 and Windows MSVC 2022, so you usually do not need to configure LD_LIBRARY_PATH or DYLD_LIBRARY_PATH manually. There is no service provider to publish; you bind JmeEphFFI or JmeService into your own Laravel service class or provider and inject it where you need ephemeris calculations.
What PHP and Laravel versions does this JPL Moshier Ephemeris wrapper support?
The package requires PHP ^8.3 because it relies on modern FFI support, plus the ext-ffi extension and a compiled JME shared library (libjme.so, libjme.dylib or jme.dll). The CALCEPH runtime library is additionally required when you use the JPL kernel-backed engine. Laravel 10 and 11 both work, but projects still pinned to PHP 8.2 will need a minor version bump before installing.
How does the package find the native libjme library on Linux, macOS and Windows?
The wrapper performs automatic platform detection, including OS, glibc version and Darwin kernel version, and loads the matching binary from libs/ubuntu22, libs/ubuntu24, the macOS arm64 build or the Windows MSVC 2022 build. You can override the resolved path with an environment variable if your binaries live somewhere custom, such as /opt/jme/libs/. If the operating system cannot be recognized, the package throws a RuntimeException instead of failing silently, which makes bootstrap-time validation straightforward.
What is the difference between the AUTO, JPL, MOSHIER and VSOP_ELP_MEEUS engine modes?
The JmeService::calc() convenience method sets the engine through jme_set_astro_models() and then calls jme_calc(). AUTO lets the native C core apply its standard JPL-then-fallback policy, JPL requires JPL kernel-backed behavior, MOSHIER forces the analytical Moshier model, and VSOP_ELP_MEEUS forces the VSOP87/ELP2000/Meeus analytical model. The PHP layer never reshapes or reinterprets the returned values, so each mode behaves exactly as the native library does.
Can I use NASA JPL DE ephemeris kernels with this package?
Yes. Use the direct jme_jpl_* functions for raw JPL and CALCEPH kernel access, and make sure the matching CALCEPH runtime library is installed alongside libjme. The wrapper exposes all 204 native jme_* functions and the semantic JME_* constants, so kernel loading, closing and state queries are all available. Keep in mind the PHP layer does not normalize kernel errors, so check the returned status codes yourself.
How do I integrate the ephemeris wrapper into a Laravel service provider?
Create a small service class that wraps JmeEphFFI or JmeService and bind it as a singleton in your provider so FFI initialization happens once per process. Validate early in boot, for example by throwing a RuntimeException when the native libraries cannot be loaded, rather than letting a calculation fail later in a request. In long-running workers such as Octane or queue consumers this also avoids paying the initialization cost on every job.
Is the package production safe for high-precision celestial mechanics calculations?
The wrapper performs no hidden rounding, output reshaping or unit conversion, and it preserves status and error buffers exactly as returned by the C library. Incomplete native behavior surfaces as JME_ERR instead of fabricated ephemeris output, which keeps results deterministic and bit-for-bit reproducible across runs on the same platform. If you persist results, use high-precision column types such as DECIMAL(38,20) so database storage does not silently truncate the values.
Does dynamic library loading add performance overhead on every request?
Platform detection and FFI initialization add roughly one to two milliseconds per process, which is negligible for typical ephemeris workloads but measurable in very high-frequency call loops. The practical fix is to bind the wrapper as a Laravel singleton or resolve it once in a service provider so the library is loaded a single time. After initialization, the call overhead is essentially the native function call itself.
How do I test this FFI wrapper in CI or Docker without a matching glibc version?
Run your test suite inside images that match the bundled binaries, such as Ubuntu 22.04 or 24.04 base images, or on GitHub Actions runners like ubuntu-22.04, ubuntu-24.04 and macos arm64. Add a bootstrap assertion that the library actually loads so misconfigured containers fail fast instead of at calculation time. If you deploy to unsupported platforms, wrap the ephemeris feature behind a flag or a graceful degradation path and document the requirement.
What are the alternatives to jpl-moshier-ephemeris-php for astronomy in PHP?
Common options are Swiss Ephemeris PHP bindings, pure-PHP implementations of VSOP87 or Meeus algorithms, and writing your own FFI bindings directly against CALCEPH. This package is a good fit when you need full coverage of the jme_* C API with raw, unmodified outputs and bundled cross-platform binaries. Pure-PHP alternatives avoid native dependencies but are typically slower and offer a narrower function surface.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections