PHPackages                             webtoucher/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. webtoucher/calendar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webtoucher/calendar
===================

Library for advanced operations with calendar days.

1.1.2(10y ago)13.3k↑21.4%BSD-3-ClausePHPPHP &gt;=5.3.0

Since Mar 30Pushed 8y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Calendar
========

[](#calendar)

This library helps to calculate date difference considering holidays.

[![Latest Stable Version](https://camo.githubusercontent.com/c709a15478631f50a27afaaf4e04e8b96d5783e1580a5d7abd3ff2bff7ae8043/68747470733a2f2f706f7365722e707567782e6f72672f776562746f75636865722f63616c656e6461722f762f737461626c65)](https://packagist.org/packages/webtoucher/calendar)[![Total Downloads](https://camo.githubusercontent.com/52d3e7a925f21e8a549b934f0c8ad6306732eb87a64af666070f2c244c1beafc/68747470733a2f2f706f7365722e707567782e6f72672f776562746f75636865722f63616c656e6461722f646f776e6c6f616473)](https://packagist.org/packages/webtoucher/calendar)[![Daily Downloads](https://camo.githubusercontent.com/924320b3f05e5d558a2313592e4a439601af44dbe544a5920471f64280281493/68747470733a2f2f706f7365722e707567782e6f72672f776562746f75636865722f63616c656e6461722f642f6461696c79)](https://packagist.org/packages/webtoucher/calendar)[![Latest Unstable Version](https://camo.githubusercontent.com/618eaa75fc62fa9532939d52797bcc03a836da515d88c121ab5b90b840a65e47/68747470733a2f2f706f7365722e707567782e6f72672f776562746f75636865722f63616c656e6461722f762f756e737461626c65)](https://packagist.org/packages/webtoucher/calendar)[![License](https://camo.githubusercontent.com/b30f28339b8de32cfe9a993d1e44b89e219c5cb6f4e15014830a75511f77b4db/68747470733a2f2f706f7365722e707567782e6f72672f776562746f75636865722f63616c656e6461722f6c6963656e7365)](https://packagist.org/packages/webtoucher/calendar)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require webtoucher/calendar "*"

```

or add

```
"webtoucher/calendar": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

Create calendar for your country:

```
$calendar = new Calendar(new Schedule('ru'));
```

Also you can use your external rules. Just create directory with your rules - e.x. 2016.json or default.json. Default rules will be used when rules for the year not exists. Use directory fullpath to init schedule.

```
$calendar = new Calendar(new Schedule('/var/www/my-site/rules/pl'));
```

Calculate number of working days with one of follow ways:

```
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), new \DateTime('2016-02-29')); // 3
```

```
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), new \DateTime('2016-02-24')); // -3
```

```
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), 5); // 3
```

```
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), -5); // -3
```

Calculate number of calendar days by working days with one of follow ways:

```
echo $calendar->workingToCalendarDays(new \DateTime('2016-02-24'), 3); // 5
```

```
echo $calendar->workingToCalendarDays(new \DateTime('2016-02-29'), -3); // -5
```

Additional information
----------------------

[](#additional-information)

You can help the project by adding rules for another countries. Send me your pull requests. But please use the same formating for json files.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~18 days

Total

3

Last Release

3712d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/500243?v=4)[Алексей Кузнецов](/maintainers/webtoucher)[@webtoucher](https://github.com/webtoucher)

---

Top Contributors

[![webtoucher](https://avatars.githubusercontent.com/u/500243?v=4)](https://github.com/webtoucher "webtoucher (13 commits)")

---

Tags

dateworking days

### Embed Badge

![Health badge](/badges/webtoucher-calendar/health.svg)

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

###  Alternatives

[rlanvin/php-rrule

Lightweight and fast recurrence rules for PHP (RFC 5545)

70011.9M60](/packages/rlanvin-php-rrule)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6339.5M56](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.8M24](/packages/league-period)[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9391.3M52](/packages/morilog-jalali)[brick/date-time

Date and time library

3663.8M108](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

20810.4M16](/packages/aeon-php-calendar)

PHPackages © 2026

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