2017 © Pedro Peláez
 

library suncalc

Calculate sun position, sunlight phases, moon position and lunar phase.

image

ypid/suncalc

Calculate sun position, sunlight phases, moon position and lunar phase.

  • Saturday, July 8, 2017
  • by ypid
  • Repository
  • 1 Watchers
  • 1 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

suncalc

Build Status BSD licensed haxelib version NPM version Packagist version, (*1)

GitHub stars GitHub forks GitHub watchers GitHub open issues GitHub closed issues GitHub open pull requests GitHub closed pull requests, (*2)

PHPPackages Rank PHPPackages Referenced By Packagist monthly downloads Packagist daily downloads Packagist total downloads, (*3)

The SunCalc module allows to calculate sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position and lunar phase for the given location and time., (*4)

SunCalc was ported to Haxe by Robin ypid Schneider to allow using it in a planed rewrite of the opening hours library., (*5)

It is based on the JavaScript implementation created by Vladimir Agafonkin (@mourner) as a part of the SunCalc.net project., (*6)

Most calculations are based on the formulas given in the excellent Astronomy Answers articles about position of the sun and the planets. You can read about different twilight phases calculated by SunCalc in the Twilight article on Wikipedia., (*7)

Refer to the API documentation for details., (*8)

Install

Install the library for your favorite language by executing one of the following commands:, (*9)

haxelib install suncalc         # Haxe
npm install suncalc             # JavaScript/Node.JS
composer require ypid/suncalc   # PHP

Getting started

Check out the following example to get started., (*10)

## Needed when executed in the root of this repository.
require_once __DIR__ . '/lib/php/Boot.class.php';

## Needed when installed via composer. FIXME
# require_once __DIR__ . '/vendor/ypid/suncalc/lib/php/Boot.class.php';

echo suncalc_SunCalc::getMoonIllumination(new Date(2000, 1, 1, 0, 0, 0));

TODO

Maintainer/tester with PHP knowledge wanted :wink:, (*11)

Composer does provide a autoload feature which is currently not used. My experience with PHP is very limited which is the reason I wrote in Haxe and generated this PHP target only because all unit tests for PHP passed. If you know how to properly support the autoload feature for this library, I will be happy to integrate it., (*12)

Internals

This library was automatically build using Haxe to target PHP., (*13)

Refer to https://github.com/ypid/suncalc when you want to contribute. Note that you should only report issues against the PHP target repository when you think the issue only occurs in the PHP port of this library. If you are unsure, report against the source repository instead., (*14)

Unit testing

Unit testing is done against the source repository in Haxe, as well as against each transcompile target (PHP in this case). You can check them out in the source repository., (*15)

Maintainer

License

BSD-2-Clause, (*16)

The Versions

08/07 2017

dev-master

9999999-dev https://github.com/ypid/suncalc

Calculate sun position, sunlight phases, moon position and lunar phase.

  Sources   Download

BSD-2-Clause

math calculation astronomy sun moon sunrise sunset twilight illumination

13/12 2015

v1.7.0

1.7.0.0 https://github.com/ypid/suncalc

Calculate sun position, sunlight phases, moon position and lunar phase.

  Sources   Download

BSD-2-Clause

astronomy sun moon