Download the PHP package tuxonice/suncalc-php without Composer

On this page you can find all versions of the php package tuxonice/suncalc-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package suncalc-php

SunCalc PHP

Tests Latest Version PHP Version Total Downloads

SunCalc PHP is a tiny PHP library for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position, and lunar phase for a given location and time. This fork brings the original gregseth/suncalc-php library up to PHP 8, publishes it as a modern Composer package, and keeps full API compatibility with the original JavaScript library created by Vladimir Agafonkin (@mourner).

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

Requirements

Installation

Install the package via Composer:

Once installed, the library is available under the Tlab\\SunCalc namespace via PSR-4 autoloading.

Usage example

Reference

Sunlight times

Returns an array with the following indexes (each is a DateTime object):

Property Description
sunrise sunrise (top edge of the sun appears on the horizon)
sunriseEnd sunrise ends (bottom edge of the sun touches the horizon)
goldenHourEnd morning golden hour (soft light, best time for photography) ends
solarNoon solar noon (sun is in the highest position)
goldenHour evening golden hour starts
sunsetStart sunset starts (bottom edge of the sun touches the horizon)
sunset sunset (sun disappears below the horizon, evening civil twilight starts)
dusk dusk (evening nautical twilight starts)
nauticalDusk nautical dusk (evening astronomical twilight starts)
night night starts (dark enough for astronomical observations)
nadir nadir (darkest moment of the night, sun is in the lowest position)
nightEnd night ends (morning astronomical twilight starts)
nauticalDawn nautical dawn (morning nautical twilight starts)
dawn dawn (morning nautical twilight ends, morning civil twilight starts)

SunCalc::times property contains all currently defined times.

Sun position

Returns an object with the following properties:

Moon position

Returns an object with the following properties:

Moon illumination

Returns an array with the following properties:

Moon phase value should be interpreted like this:

Phase Name
0 New Moon
Waxing Crescent
0.25 First Quarter
Waxing Gibbous
0.5 Full Moon
Waning Gibbous
0.75 Last Quarter
Waning Crescent

Moon rise and set times

Returns an object with the following indexes:

By default, it will search for moon rise and set during local user's day (from 0 to 24 hours). If $inUTC is set to true, it will instead search the specified date from 0 to 24 UTC hours.

What changed in this fork

Development

  1. Install dependencies:

  2. Run the test suite:

  3. (Optional) Run static analysis and coding standards:

Credits

License

Released under the GPLv2 license. See the LICENSE file for details.


All versions of suncalc-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tuxonice/suncalc-php contains the following files

Loading the files please wait ...