PHP code example of shahruslan / production-calendar

1. Go to this page and download the library: Download shahruslan/production-calendar 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/ */

    

shahruslan / production-calendar example snippets


composer 

use Shahruslan\ProductionCalendar\Calendar;

$calendar = new Calendar('your-token');

// Получение календаря на весь год
$calendarForYear = $calendar->getPeriodForYear(2024);

// Получение календаря на определённый месяц
$calendarForMonth = $calendar->getPeriodForMonth(2024, 1);

// Получение календаря на определённый день
$calendarForDay = $calendar->getPeriodForDay(new DateTime('2024-01-01'));

use Shahruslan\ProductionCalendar\Calendar;

$calendar = new Calendar('your-token');
$period = $calendar->getPeriod('07.01.2024-09.01.2024', region: 23);
print_r($period);

$calendar = new Shahruslan\ProductionCalendar\Calendar('token');
$data = $calendar->isWorkingDay(new DateTimeImmutable('14.05.2024'));
var_dump($data);
$data = $calendar->setRegion(23)->isWorkingDay(new DateTimeImmutable('14.05.2024'));
var_dump($data);


new Calendar(
	'token',
	isSixDayWeek: true, // включить учет по 6-ти дневной рабочей неделе
	isWeekendsOfSchrodinger: true, // учитывать ли так называемые нерабочие дни с сохранением заработной платы, которые начали практиковать с 2020 года (В период пандемии COVID-19)
	compact: true, // будут выводиться только особые дни, которые отличаются от обычного календаря
);