Pave nechinguva kubva pandakanyora nezve PHP Zmanim - basa randakaita nayo uye zvinhu zvandakadzidza ndichizviita. Asi pasinei nokunonoka, ndaigara ndichida kupfuudzira kurukurirano yacho. Ndizvo zvatiri kuita nhasi.
Mune yanguyekutanga positi , ndakatsanangura maitiro ekuisa uye kutanga neiyo PHP Zmanim raibhurari. Zvadaro, muchikamu chinotevera , ndakachera mukuverenga nguva dzakaoma zvikuru, uye simba rechokwadi rechishandiso - kushandisa pfungwa dzeRabhi dzinonyanya kuzivikanwa dzezmanim dzakasiyana-siyana. Ndiri kusimudza pandakasiira ndiine kupindirana kushoma, saka kana iwe uchida kutora miniti kuti udzoke kumhanyisa, ndabatanidza kune izvo zvakapfuura.
Chinangwa nhasi ndechekuongorora mashandisirwo ePP Zmanim anofamba kupfuura kushandiswa kuri nyore kweraibhurari. Izvo zvinosanganisira:
Zvakare, ndinoda kutanga nekutaura kutenda kwangu kune vanhu vakaita kuti zvese izvi zviitike. Kunyanya, pakati perunyorwa rurefu rwemazita ndiZachary Weixelbaum, muchengeti weiyo PHP Zmanim raibhurari pachayo, uye Eliyahu Hershfeld: mugadziri weKosher Java raibhurari payakavakirwa PHP Zmanim.
Patakasiya, taive neiyo yakasimba basic PHP script iyo:
Zvaiita seizvi:
<?php require 'vendor/autoload.php'; use PhpZmanim\Zmanim; use PhpZmanim\Calendar\ComplexZmanimCalendar; use PhpZmanim\Geo\GeoLocation; # Set variables: $locname = "Beit Knesset Chochmat Shlomo, Beachwood, OH"; $lat = 41.4939407; $long = -81.516709; $elev = 0; $tz = 'America/New_York'; $getyear = 2024; $getday = 20; $getmonth = 12; $testzmanim = Zmanim::create($getyear, $getmonth, $getday, $locname, $lat, $long, $elev, $tz); $sunrise = $testzmanim->sunrise; echo "$sunrise\n"; ?>
Asi kubuda kwezuva kunongova mavambo. Uchishandisa chero yakavakirwa-mukati macalculation (ayo anotsanangurwa paGitHub readme peji ), unogona kudhonza dzakasiyana siyana dzenguva. Semuenzaniso, kuti ndiwane Mincha Gedola kuti ashandise imwe pfungwa yaRabhi, ini ndinogona kusanganisira:
$gedolah = $zmanim->minchaGedola16Point1Degrees
Mune yekupedzisira blog, ini zvakare ndakavhara nzira dzekushandisa PHP Zmanim's fomati nzira kuti iyo inobuda iverengeke:
$gedolah = $gedolah->format('g:i a');
Kune avo vasingapedzi nguva yakawanda musinagoge (hapana mhosva, hapana nyadzi, iwe uchiri kugamuchirwa pano) zvingasava pachena, asi - pasinei nezita rezman - masangano mashoma anonyengetera Mincha (masikati minamato) paMincha Ketana, Mincha Gedola, kana Plag haMincha.
Muchokwadi, basa rakawanda rine chekuita nekuverenga nguva harina kuita neiyo yakatwasuka "Inguvai Mincha Gedola?" uye nezvimwe ne "Kunonoka sei muzuva tinogona kuronga Mincha zvine musoro kuti munhu wese ave nenguva yekusvika pano mushure mebasa; asi hazvina kunonoka zvekuti hapana anouya nekuti vachapotsa kudya kwemanheru?
Kana izvo zvakanyanyisa dzidziso, ndibvumire kugovera zvine musoro jenga puzzle inotariswa nesinagogi yangu pakumisikidza hurongwa hwevhiki:
Nepo dzimwe nguva dzese dzandakavhara mumablog ekutanga dzichine basa, ndinovimba, uri kutanga kuona kuti dzinonyanya kukosha pane zvaungatarisira.
Saka unoita sei nguva (senge shkia/kuvira kwezuva) wobva wawedzera kana kubvisa maminetsi? Isu tichatanga neiyo script yataive nayo kare:
<?php require 'vendor/autoload.php'; use PhpZmanim\Zmanim; use PhpZmanim\Calendar\ComplexZmanimCalendar; use PhpZmanim\Geo\GeoLocation; # Set variables: $locname = "Beit Knesset Chochmat Shlomo, Beachwood, OH"; $lat = 41.4939407; $long = -81.516709; $elev = 0; $tz = 'America/New_York'; $getyear = 2024; $getday = 20; $getmonth = 12; $testzmanim = Zmanim::create($getyear, $getmonth, $getday, $locname, $lat, $long, $elev, $tz);
Kune izvozvo, isu tichawedzera kodhi kuti zuva rinyure:
$sunset = $zmanim->sunset;
Uye zvino, tichabvisa maminetsi gumi nemasere kuti tiwane nguva yekubatidza kenduru:
$candles = date('g:i a', strtotime($sunset . " -18 minutes"));
Izvo ndizvo. Iwe unongoshandisa PHP's tambo-kune-nguva basa. Ndine urombo kana ndakakuchengetai muchifungira. Asi zviri nyore chaizvo.
(... nemimwe mibvunzo yakakosha asi inoshungurudza inowanzo bvunzwa mukati nepedyo nesinagogi rako.)
Pamwe chete nekuverenga kwezuva, raibhurari yeKosherJava (uye saka raibhurari yePP Zmanim) ine nzira nemabasa ekukurumidza kupa ruzivo serwabvunzwa pamusoro.
Chekutanga kunzwisisa ndechekuti PHP Zmanim chinhu chatave kushanda nacho kusvika parizvino chave chiri chinhu cheZmanim - chinhu chine nguva yakatarwa yerimwe zuva. Kune zvinhu zvinosanganisira misi pachayo, isu tinosimbisa chinhu chejewishCalendar. Nhau dzakanaka ndedzekuti ZVINHU zviri nyore kugadzira. Chaunongoda chete gore, mwedzi, uye zuva.
<?php require 'vendor/autoload.php'; use PhpZmanim\Zmanim; use PhpZmanim\Calendar\ComplexZmanimCalendar; use PhpZmanim\Geo\GeoLocation; # Set variables: $getyear = 2024; $getday = 21; $getmonth = 09; $jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($getyear, $getmonth, $getday));
Isu tava nejewishCalendar chinhu chekushanda nacho uye tinogona kushandisa nzira dzakafanana nedzatakawana kwenguva. Semuenzaniso: Tichifungidzira zuva ratakasarudza raive Mugovera, tinogona kuwana chikamu cheTorah:
$format = Zmanim::format(); $parshaeng = json_decode('"' . $format->formatParsha($jewishCalendar) . '"');
(regai magadzirirwo e$fomati parizvino. Tichapinda mazviri munguva pfupi).
Kana iwe wakamhanyisa iyo kodhi, $parshaeng aizokupa:
Parshas Ki Savo
Uchaona kuti taisada kupa latitude, longitudo, nguva yenguva, nezvimwewo. Handikwanise kusimbisa zvakakwana kuti kugona uku ndega - kugona kuwana misi, zvikamu zveTorah, nezvimwe - zvinoita kuti raibhurari yePHP Zmanim ishande pane yayo. yako, kunyangwe pasina maverengero enguva.
Chikamu cheTorah? Ehe saizvozvo! Apa ndipo panopinda iyo $format line.
Chekutanga, tsananguro yekuti chii: Inzira inogadzirisa zvinhu zvakaita seZmanim uye jewishCalendar, kuseta zviratidziro uye zvinobuda sarudzo. Kuseta Zmanim ::format() pasina chero ruzivo rwechirungu. Asi ipapo unogona kuudza sisitimu yaunoda Chihebheru neiyi mutsara wekuwedzera:
$format->setHebrewFormat(true)
Zvino, kana uchimhanyisa json_decode('”' . $format->formatParsha($jewishCalenda) . '”') mutsara, unogona kuwana:
כי תבוא
Kuisa zvese pamwe chete:
<?php require 'vendor/autoload.php'; use PhpZmanim\Zmanim; use PhpZmanim\Calendar\ComplexZmanimCalendar; use PhpZmanim\Geo\GeoLocation; # Set variables: $getyear = 2024; $getday = 21; $getmonth = 09; $jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($getyear, $getmonth, $getday)); $format = Zmanim::format(); $parshaeng = json_decode('"' . $format->formatParsha($jewishCalendar) . '"'); $format->setHebrewFormat(true); $parshaheb = json_decode('"' . $format->formatParsha($jewishCalendar) . '"'); echo "$parshaheb - $parshaeng\n";
Izvi zvaizoratidza: nekuti תבוא - Ki Savo
Zvikurukuru, izuva ripi VAHEBHERU?
Kufanana nemuenzaniso wapfuura, tinotanga nejewishCalendar uye chinhu chefomati.
$jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($theyear, $themonth, $theday)); $format = Zmanim::format();
Zvadaro, tinowedzera mutsara mumwe chete kuti tiise chimiro kuchiHebheru.
$format->setHebrewFormat(true);
Uye pakupedzisira (uye zvakapusa), isu tinokumbira yakatwasuka karenda chinhu chinobuda:
$zmandate = json_decode('"' . $format->format($jewishCalendar) . '"');
Ndizvo chaizvo zvaunoda. Mhedzisiro yacho ndeichi:
17 Elul, 5784
Ehe, kunyangwe isu takatsanangura setHebrewFormat yakabuda muChirungu.
Kuti tiite kuti zuva rechiHebheru riratidzike zvizere muchiHebheru - zvese mazwi nemabhii - tinokumbira nzira yakati siyanei inonzi, zvakakodzera zvakakwana, HebrewDateFormatter. Uchifungidzira (zvakare zvakare) iwe unomisikidza yako yekutanga mavhezheni uye kugadzira chinhu chejewishCalendar, kodhi yekuburitsa zuva remutauro wechiHebheru ingave:
$hebformat = HebrewDateFormatter::create(); $hebformat->setHebrewFormat(true); $hebdate = json_decode('"' . $hebformat->format($jewishCalendar) . '"'); print("Hebrew date: $hebdate\n");
Izvo zvinokupa iwe:
Hebrew date: י״ח אלול תשפ״ד
Dzimwe nguva, unofanirwa kutarisa kana zuva chairo riri… zvakanaka, izuva chairo. SaRosh Chodesh (mwedzi mutsva) kana chikamu chezororo remazuva mazhinji (saSukkot).
Zvinoitika kuti iyo PHP Zmanim nzira inoita kuti izvi zvive nyore. Tichifunga kuti watanga nenzira yakafanana nemimwe mienzaniso,
kana uchinge wamisa chinhu chejewishCalendar, zviri nyore se
$jewishCalendar->isRoshHashana(); $jewishCalendar->isSuccos();
Kana zuva racho richienderana nezororo, rinodzoka "chokwadi," uye unogona kuenderera nechero pfungwa kana maitiro aunoda, sekuratidza zuva (kana kwete).
Zvitende kana kwete, pachine zvimwe zvekuvhara. Mumavhiki anouya pese pandinosvika pazviri, ndinoda kuvhara nzira dzekusimudzira mabasa emuchadenga akavakirwa mukati mekuverenga nguva. Zvitende kana kusazvitenda, zvinogona kunyanya kukosha maererano nekuve nenguva dzakakwana dzezvinhu zvakaita sekutanga uye kupera kweShabbat nemazororo, pamwe nemamwe mabhii.
Zvichakadaro, kana paine chimwe chinhu chaungade kundiona ndichivhara; kana kana uine mibvunzo, kugadzirisa, kana kudos, inzwa wakasununguka kuvasiya mune zvakataurwa pazasi.