PHP code example of ivy47 / hebcal-api

1. Go to this page and download the library: Download ivy47/hebcal-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ivy47 / hebcal-api example snippets


use Ivy47\HebcalApi\Facades\HebcalApiFacade as HebcalApi;

$params = [
            'v' => 1,
            'maj' => 'on',
            'min' => 'on',
            'mod' => 'on',
            'nx' => 'on',
            'month' => 'x',
            'ss' => 'on',
            'mf' => 'on',
            'c' => 'on',
            ...
            ];

$hebcalCalendarResponse = HebcalApi::getHolidays($params);

use Ivy47\HebcalApi\Helpers\HebcalHelper;

$hebcalCalendarResponseItems = $hebcalCalendarResponse->getItems([
            HebcalHelper::HEBCAL_CATEGORY_CANDLES,
            HebcalHelper::HEBCAL_CATEGORY_HOLIDAY,
        ]);

use Ivy47\HebcalApi\Facades\HebcalApiFacade as HebcalApi;

$params = [
            'gy' => 2011,
            'gm' => 6,
            'gd' => 2,
            'g2h' => 1,
            ...
            ];

$hebrewDateResponse = HebcalApi::convertDate($params);

use Ivy47\HebcalApi\Facades\HebcalApiFacade as HebcalApi;

$params = [
            'geonameid' => '3448439',
            'M' => 'on'
            ...
            ];

$shabbatResponse = HebcalApi::getShabbatTimes($params);

use Ivy47\HebcalApi\Facades\HebcalApiFacade as HebcalApi;

$params = [
            'geonameid' => '3448439',
            'date' => '2021-03-23'
            ...
            ];

$zmanimResponse = HebcalApi::getZmanim($params);

use Ivy47\HebcalApi\Facades\HebcalApiFacade as HebcalApi;

$params = [
            'v' => 'yahrzeit',
            'years' => 3,
            'hebdate' => 'on',
            'yizkor' => 'on',
            'y1' => 1983,
            'm1' => 4,
            'd1' => 15,
            's1' => 'on',
            't1' => 'Yahrzeit',
            'n1' => 'Example 1'
            ...
            ];

$yahrzeitResponse = HebcalApi::generateYahrzeit($params);

// HebcalCalendarResponse example

/** @var \Ivy47\HebcalApi\Http\Resources\HebcalCalendar\HebcalCalendarResource $hebcalCalendarResource */
$hebcalCalendarResource = $hebcalCalendarResponse->getResource();

$body = $hebcalCalendarResponse->getBody();
$decoded = $hebcalCalendarResponse->getDecoded();

$response = $hebcalCalendarResponse->getResponse();