Download the PHP package mjaschen/astrotools without Composer
On this page you can find all versions of the php package mjaschen/astrotools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mjaschen/astrotools
More information about mjaschen/astrotools
Files in mjaschen/astrotools
Package astrotools
Short Description General Purpose Astronomy Library for PHP
License MIT
Homepage https://github.com/mjaschen/astrotools
Informations about the package astrotools
Astrotools
Astrotools is a general purpose PHP library for astronomy.
Requirements
- PHP >= 7.3
- bcmath extension
Older PHP versions
- 0.1.x branch supports PHP >= 7.0
- 0.0.x branch supports PHP 5.4 - 5.6. For details see the next section.
Installation
PHP 7.0, PHP 7.1, PHP 7.2
If you need to use Astrotools with PHP 7.0, 7.1 or 7.2 just require version 0.1:
Please keep in mind, that the 0.1.x branch is no longer maintained and won't get any updates.
PHP 5
If you need to use Astrotools with PHP 5.4, 5.5, or 5.6, just require version 0.0.2:
Please keep in mind, that the 0.0.x branch is no longer maintained and won't get any updates.
Features
- Julian day calculation (forward/reverse)
- Sidereal time calculation (GMST, local sidereal time)
- Date of Easter calculation
- Time helper
Why not use PHP's calendar extension?
Some implemented features (e.g. calculation of Julian day or Date of Easter) are already provided by PHP's calendar extension.
These functions come with some problems, e.g. easter_date()
can only calculate the Date of Easter for the timerange of unix timestamps (1970 January 1 to somewhere around 2037/2038).
Usage Examples
Calculation of the Julian day from Date/Time
The code above produces the output shown below:
Calculation of Date/Time from Julian day
The code above produces the output shown below:
Calculation of sidereal time for a given Date/Time
Greenwich sidereal time
The code above produces the output shown below:
Local sidereal time
Local sidereal time for Berlin, Germany (longitude = 13.5 degrees east):
The code above produces the output shown below:
Time helper
Convert hours, minutes, and seconds to decimal time
The code above produces the output shown below:
Convert decimal time to hours, minutes, and seconds
The code above produces the output shown below:
Convert between time and hour angle
The code above produces the output shown below:
Date of Easter Calculation
The code above produces the output shown below:
Calculation of ΔT
There exist multiple methods to get the value of ΔT for a given (decimal) year. One can lookup the value in tables and interpolate it for the wanted date or calculate it using polynomial expressions.
Astrotools currently provides the calculation of ΔT with polynomial expressions. Reasonably accurate values are provided for the timespan between the years -500 and 2150.
The code above produces the output shown below:
Todo
- Support for microseconds in Julian day calculation
- Implement ΔT determination by table lookups
References
- Julian day formula - Astronomical Applications Department of the U.S. Naval Observatory
- Julian Date Converter - Astronomical Applications Department of the U.S. Naval Observatory
- Julian day - Wikipedia
- ΔT
- Astronomical Algorithms, Jean Meuss, 1998, ISBN 978-0943396613
- Polynomial Expressions For Delta T (ΔT)
All versions of astrotools with dependencies
ext-bcmath Version *