Weave Code
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. Exposes all public jme_* functions and JME_* constants with no output reshaping. Supports AUTO/JPL/MOSHI​ER/VSOP engines and direct JPL/CALCEPH kernel access via shared libs.

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
What Laravel versions support this package, and do I need PHP 8.3+?
This package requires PHP 8.3+ due to FFI and dynamic library loading features. Laravel 10/11 (PHP 8.2+) may need a minor version bump to PHP 8.3+. Test thoroughly in your deployment environment, especially if using Windows or custom Docker images.
How do I install and configure this in a Laravel project?
Run `composer require jayeshmepani/jpl-moshier-ephemeris-php`. No additional configuration is needed for most cases—it auto-detects your OS (Linux, macOS, Windows) and loads the correct binary from the `libs/` directory. For custom paths, set `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH` before runtime.
Does this package work with Windows (e.g., Azure App Service) or only Linux/macOS?
Yes, it supports Windows via MSVC 2022 binaries. Test on Windows Server 2022 + PHP 8.3+ to ensure compatibility. The dynamic loader prioritizes `jme.dll` for Windows environments, but unsupported PHP builds may cause initialization failures.
What if my deployment environment lacks glibc/Darwin support or uses Alpine Linux?
The package throws a `RuntimeException` if your OS isn’t recognized (e.g., Alpine Linux with glibc backports). Validate your environment early in Laravel’s bootstrap (e.g., `bootstrap/app.php`) or use static binaries by placing them in `vendor/bin/` and setting `LD_LIBRARY_PATH` manually.
Can I use this for high-precision astronomy in production, or are there edge cases?
This wrapper retains full compatibility with NASA JPL’s Moshier Ephemeris, including JPL kernels and VSOP engines. However, dynamic loading adds ~1–2ms overhead and may fail silently if `libs/` is misconfigured. Test with your target Dockerfiles or deployment scripts to ensure resilience.
How do I switch between AUTO, JPL, MOSHIER, or VSOP engines in Laravel?
Use `JmeService::calc()` with the `ENGINE` parameter (e.g., `JmeService::calc($time, $target, ['ENGINE' => 'JPL'])`). For raw JPL kernel access, call `jme_jpl_*` functions directly. The wrapper preserves all native outputs without reshaping.
What if I need to customize the library path or use a non-bundled binary?
Override the default path by setting the `JPL_MOSHIER_LIB_PATH` environment variable before initialization. For example, `export JPL_MOSHIER_LIB_PATH=/opt/jme/libs/linux-x64`. Alternatively, manually load the library via `FFI::cdef()` and pass the path to `JmeEphFFI::load()`.
Are there alternatives to this package for celestial mechanics in PHP?
This is the only PHP FFI wrapper for the JPL Moshier Ephemeris C library, offering direct access to NASA’s high-precision algorithms. Alternatives like `php-astronomy` or `php-ephemeris` are less accurate and lack JPL kernel support. For pure PHP solutions, consider `php-astronomy` but expect lower precision.
How do I handle errors or missing libraries in production?
The package throws `RuntimeException` if libraries fail to load. Validate paths early in Laravel’s bootstrap (e.g., `EphemerisService::ensureNativeLibs()`). For graceful degradation, wrap calls in try-catch blocks and log failures. Avoid silent failures in production.
Does this package work with Laravel’s service container or facades?
Yes, bind the `JmeService` to Laravel’s container in `AppServiceProvider` for dependency injection. Example: `app()->bind(JmeService::class, fn() => new JmeService());`. Use facades or direct service calls for convenience, but ensure the `libs/` directory is accessible.
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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony