PHPackages                             gozoro/yii2-russian-calendar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. gozoro/yii2-russian-calendar

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

gozoro/yii2-russian-calendar
============================

Производственный календарь РФ на основе xmlcalendar.ru. Russian working calendar based on the xmlcalendar.ru.

v0.0.1(6y ago)1292MITPHPPHP &gt;=5.5.9

Since Feb 14Pushed 6y ago1 watchersCompare

[ Source](https://github.com/gozoro/yii2-russian-calendar)[ Packagist](https://packagist.org/packages/gozoro/yii2-russian-calendar)[ Docs](https://github.com/gozoro/yii2-russian-calendar)[ RSS](/packages/gozoro-yii2-russian-calendar/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

yii2-russian-calendar
=====================

[](#yii2-russian-calendar)

Yii2 комопонент производственного календаря РФ [gozoro/russian-calendar](https://github.com/gozoro/russian-calendar) на основе xmlcalendar.ru для PHP. Yii2 component to use russian working calendar [gozoro/russian-calendar](https://github.com/gozoro/russian-calendar) based on the xmlcalendar.ru for PHP.

Установка
---------

[](#установка)

```
	composer require gozoro/yii2-russian-calendar

```

Конфигурация
------------

[](#конфигурация)

```
'components' => [

	...

	'calendar' => [
		'class' => 'gozoro\russian_calendar\components\RussianCalendar'
	],

	...

],
```

Использование
-------------

[](#использование)

```
$calendar = Yii::$app->calendar;

$date = '2019-01-02';
print "Дата: ".$date."\n";
print "ЭТО РАБОЧИЙ ДЕНЬ? ".($calendar->checkWorkingDay($date)?"ДА":"НЕТ")."\n"; // НЕТ

print "ЭТО ПОЛНЫЙ РАБОЧИЙ ДЕНЬ? ".($calendar->checkFullWorkingDay($date)?"ДА":"НЕТ")."\n"; // НЕТ

print "ЭТО КОРОТКИЙ РАБОЧИЙ ДЕНЬ? ".($calendar->checkShortWorkingDay($date)?"ДА":"НЕТ")."\n"; // НЕТ

print "ЭТО ВЫХОДНОЙ ДЕНЬ? ".($calendar->checkWeekend($date)?"ДА":"НЕТ")."\n"; // ДА

print "ЭТО ПРАЗДНИЧНЫЙ ДЕНЬ? ".($calendar->checkHoliday($date)?"ДА":"НЕТ")."\n"; // ДА

print "НАЗВАНИЕ ПРАЗДНИКА: ".$calendar->getHolidayName($date)."\n"; // Новогодние каникулы (в ред. Федерального закона от 23.04.2012 № 35-ФЗ)

print "СЛЕДУЮЩИЙ РАБОЧИЙ ДЕНЬ: ".$calendar->getNextWorkingDay($date)."\n"; // 2019-01-09
```

**Выходные дни**

По умолчанию выходными считаются суббота и воскресенье. Это можно изменить указав выходные дни при вызове методов. В этом случае выходными днями будут считаться только указанные дни недели.

```
$my_weekends = [0]; // выходной только воскресенье, суббота рабочий день
$calendar->checkWorkingDay($date, $my_weekends);
```

**Продолжительность выходных и праздников**

Дополнительно можно получить список последовательных дат выходного или праздничного периода.

Получение списка дат выходного периода

```
$weekends = [0,6];

// полный список
print_r($calendar->getWeekendDateArray($date, $weekends, true);

//Array
//(
//    [0] => 2018-12-30
//    [1] => 2018-12-31
//    [2] => 2019-01-01
//    [3] => 2019-01-02
//    [4] => 2019-01-03
//    [5] => 2019-01-04
//    [6] => 2019-01-05
//    [7] => 2019-01-06
//    [8] => 2019-01-07
//    [9] => 2019-01-08
//)

// только даты больше чем $date и даты в формате d.m.Y
print_r($calendar->getWeekendDateArray($date, $weekends, false, 'd.m.Y');

//Array
//(
//    [0] => 03.01.2019
//    [1] => 04.01.2019
//    [2] => 05.01.2019
//    [3] => 06.01.2019
//    [4] => 07.01.2019
//    [5] => 08.01.2019
//)
```

Получение списка дат праздничного периода

```
// полный список
print_r($calendar->getHolidayDateArray($date, true);

// Array
//(
//    [0] => 2019-01-01
//    [1] => 2019-01-02
//    [2] => 2019-01-03
//    [3] => 2019-01-04
//    [4] => 2019-01-05
//    [5] => 2019-01-06
//    [6] => 2019-01-07
//    [7] => 2019-01-08
//)

// только даты больше чем $date и даты в формате d.m.Y
$holidayArray = $calendar->getHolidayDateArray($date, false, 'd.m.Y';
print_r($holidayArray);

//Array
//(
//    [0] => 03.01.2019
//    [1] => 04.01.2019
//    [2] => 05.01.2019
//    [3] => 06.01.2019
//    [4] => 07.01.2019
//    [5] => 08.01.2019
//)

// Сколько дней осталось отдыхать?
print count($holidayArray); // 6
```

**Кэширование**

Компонент по умолчанию кэширует xml-файлы в директории @app/runtime/russian-calendar, чтобы при каждом вызове не делать запросы к xmlcalendar.ru.

В конфигурации можно явно задать параметры кэширования:

```
'components' => [

	...

	'calendar' => [
		'class' => 'gozoro\russian_calendar\components\RussianCalendar',
		'cacheFolder' => '/home/user/mycache/russian-calendar', // директория для кэша, если не существует, то будет создана автоматически
		'cacheDuration' => 3600, // время жизни кэша в секундах

		'fileMode' => 0664, // права на файлы кэша
		'dirMode' => 0775,  // права на директорию кэша

		'cacheEnable' => true, // включить/отключить использование кэша, по умолчанию true
	],

	...

],
```

**Локализация**

По умолчанию компонент использует язык проекта:

```
Yii::$app->language;
```

В конфигурации можно указать локаль явно:

```
'components' => [

	...

	'calendar' => [
		'class' => 'gozoro\russian_calendar\components\RussianCalendar',
		'locale' => 'ru',
	],

	...

],
```

Компонент поддерживает только две локали: **ru** и **en**.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a273abe77cdd4c74270a90320efbeb4d4dfb3ceac5b4d505ce2ccafddf1e06e0?d=identicon)[gozoro](/maintainers/gozoro)

---

Top Contributors

[![gozoro](https://avatars.githubusercontent.com/u/13768280?v=4)](https://github.com/gozoro "gozoro (2 commits)")

---

Tags

yii2calendarcomponentyii2-extensionproductionrussianworkingworking-calendarproduction-calendarпроизводственныйкалендарьРФпроизводственный календарьпроизводственный календарь РФxmlcalendarxmlcalendar.ru

### Embed Badge

![Health badge](/badges/gozoro-yii2-russian-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/gozoro-yii2-russian-calendar/health.svg)](https://phpackages.com/packages/gozoro-yii2-russian-calendar)
```

###  Alternatives

[wapmorgan/yii2-inflection

Inflection extension for Yii2. Support for English / Russian languages to inflect words / names / numbers / money / date&amp;time.

32112.3k](/packages/wapmorgan-yii2-inflection)[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)[dlds/yii2-mlm

Yii2 Multi Level Marketing component

183.8k](/packages/dlds-yii2-mlm)[kriss/yii2-calendar-schedule

Yii2 Calendar Schedule

107.9k](/packages/kriss-yii2-calendar-schedule)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
