Download the PHP package zachweix/php-zmanim without Composer
On this page you can find all versions of the php package zachweix/php-zmanim. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zachweix/php-zmanim
More information about zachweix/php-zmanim
Files in zachweix/php-zmanim
Package php-zmanim
Short Description Port of KosherJava to PHP
License LGPL-2.1-only
Informations about the package php-zmanim
PhpZmanim
A PHP port of the KosherJava Zmanim API from Eliyahu Hershfeld (code at the KosherJava Zmanim project). See Kosher Java documentation for comments for every class variable and method. See below for how to install and a more detailed list of what you can access and methods you can call. Once instantiated, you can ask for many Zmanim right out of the gate:
Installation (with Composer)
Setup
Instantiation
You can instantiate a new Zmanim
object with the Zmanim::create()
function. (If you want, you can instantiate by creating a GeoLocation
object and a ComplexZmanimCalendar
object like in KosherJava). There are currently two ways to calculate the Zmanim times, SunTimesCalculator and NoaaCalculator; the default calculator is NoaaCalculator.
Via Zmanim::create()
The expected arguments are:
$year
, $month
, $day
, $locationName
, $latitude
, $longitude
, $elevation
, $timeZone
All arguments are optional. The default values are today in Greenwich Mean Time at elevation 0. As you can see below, these are how you would set the location to either the default location, or a custom location. The location name is not used anywhere, and is only for your own internal reference (it can be null if you want).
If you give null
as the year, month or day, today's UTC date will be used, which may be different than your current date (e.g. 9:00PM in New York on February 21 is 2:00AM in UTC on February 22).
Via GeoLocation
and ComplexZmanimCalendar
GeoLocation
's expected arguments are:
$locationName
, $latitude
, $longitude
, $elevation
, $timeZone
ComplexZmanimCalendar
's expected arguments are:
$geoLocation
, $year
, $month
, $day
If you give null
as the year, month or day, today's UTC date will be used, which may be different than your current date (e.g. 9:00PM in New York on February 21 is 2:00AM in UTC on February 22).
Usage
Any parameter called like $zmanim->sunrise
or a method name you see that is called like $zmanim->get("Sunrise")
can be called by concatenating get
to the zman and making sure to capitalize the first letter, so you would get $zmanim->getSunrise()
; the following three will return identical results, all of which are a Carbon object.
If you want to factor elevation when calculating, make sure to set the elevation when instantiating the object. If you set an elevation other than 0 and want to ignore elevation, you can call $zmanim->setUseElevation(false)
and then when you want to use it again, simply call $zmanim->setUseElevation(true)
.
Available Methods
List of Zmanim
Here is a list of many possible Zmanim you can request, all of them will return a Carbon object in the timezone set when creating the $zmanim
object. If you don't find what you are looking for, see below for how to get more custom Zmanim.
Sunrise:
Sunset
Length of Shaah Zmanim (in minutes)
Alos Hashachar
Misheyakir
Sof Zman Shma
Sof Zman Tfila
Erev Pesach
Chatzos
Mincha Gedola
Mincha Ketana
Plag Hamincha
Candle Lighting
Start of Bain Hasmashos (According to Rabbeinu Tam)
Tzais
Chatzos Halayla (Midnight)
Molad Zmanim
Notes
- AteretTorah Zman is calculated based on a day being from Alos72Zmanis until 40 minutes after sunset. However, the exact time offset can be changed by calling
$zmanim->setAteretTorahSunsetOffset($ateretTorahSunsetOffset)
. - FixedLocalChatzos is based on a fixed time for Chatzos throughout the year, see KosherJava's documentation for more details.
- Baal Hatanya calculates Zmanim based on a zenith of 1.583 degrees below the 90 degree geometric zenith.
Alternative Zmanim
If you are looking for any Zman which is an offset from sunrise or sunset that is not listed in the list above, you can call one of the following methods with your offset.
You can use those times as parameters for custom calculations for the following functions:
Jewish Calendar Calculations
For the usage syntax you can look at the KosherJava documentation. (TODO: Add the methods here as well).
GeoLocation Mathematical Calculations
There are a few functions that can be run for calculations on GeoLocation objects: