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

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

devhelp/calendar
================

1.1(12y ago)028MITPHPPHP &gt;=5.3

Since Apr 8Pushed 12y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (7)Used By (0)

[![Build Status](https://camo.githubusercontent.com/d1bf7366d99b4ea3051adfda88bc08f9e2c25622ac984a3e74c69541d73a3125/68747470733a2f2f7472617669732d63692e6f72672f64657668656c702f63616c656e6461722e706e67)](https://travis-ci.org/devhelp/calendar)

Credits
-------

[](#credits)

Plugin brought to you by : Devhelp.pl ()

Purpose
-------

[](#purpose)

Purpose of Devhelp/Calendar package is to help creating calendar with easy to define events that occur both on constant date as well as on date that is somehow referenced from another event (or calculated using custom logic)

Is also helps defining days off that are referenced to certain day, event or are calculated using custom logic

Is if for you ?
---------------

[](#is-if-for-you-)

- Do you want to define calendar with events ?
- Do you want to store events that are related to each other ?
- Do you want to define events that occurs on different days depending on year or other events ?
- Do you want to have easy way of calculating days off ?

If one of the answer was "yes" then I hope you'll enjoy using this package

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

[](#installation)

### Composer

[](#composer)

add package to composer.json

```
"require" : {
    "devhelp/calendar": "dev-master"
}

```

run update

```
composer update devhelp/calendar

```

Usage
-----

[](#usage)

#### Example calendar definition

[](#example-calendar-definition)

```
$definition = array(
    Calendar::DAYS_OFF => array(
        new Day(3, 1),
        new Day(4, 1),
        new Day(5, 1),
        new DayRange(new Day(3, 1), new Day(10, 1)),
        new DayReference('national/constitution-day'),
    ),
    Calendar::EVENTS => array(
        'religion' => array(
            'easter' => function (Calendar $calendar, $year) {
                $a = $year % 19;
                $b = intval($year / 100);
                $c = $year % 100;
                $d = intval($b / 4);
                $e = $b % 4;
                $f = intval(($b + 8) / 25);
                $g = intval(($b - $f + 1) / 3);
                $h = (19 * $a + $b - $d - $g + 15) % 30;
                $i = intval($c / 4);
                $k = $c % 4;
                $l = (32 + 2 * $e + 2 * $i - $h - $k) % 7;
                $m = intval(($a + 11 * $h + 22 * $l) / 451);
                $p = ($h + $l - 7 * $m + 114) % 31;
                $day = $p + 1;
                $month = intval(($h + $l - 7 * $m + 114) / 31);

                return new Day($day, $month);
            },
            'divine-mercy-sunday' => new DayReference('religion/easter', '+7 day'),
        ),
        'national' => array(
            'independence-day' => new Day(11, 11),
            'constitution-day' => new Day(3, 5),
            'joining-european-union' => new DayReference('national/constitution-day')
        ),
        'birthday' => array(
            'joanne' => new Day(23, 3),
            'paul' => new Day(31, 8),
            'margaret' => new DayReference('birthday/paul', '+2 day'),
        ),
        'specific-day' => array(
            'first-day-of-march' => new Day(1, 3),
            'last-day-of-february' => new DayReference('specific-day/first-day-of-march', '-1 day'),
            '7-august' => new Day(7, 8),
            '7-september' => new DayReference('specific-day/7-august', '+1 month'),
        )
    )
);

$calendar = new \Devhelp\Calendar\Calendar($definition);

```

#### Get Event Day

[](#get-event-day)

for events that are defined by reference (with value other than 0) or custom function you need to specify year to do the math

```
$calendar->getDay('religion/easter', 2013);

```

for events referenced with simple reference or defined as day just pass event name

```
$calendar->getDay('birthday/joanne');

$calendar->getDay('national/joining-european-union');

```

#### Get Days Off

[](#get-days-off)

you can get days off for defined in the calendar for certain year

```
$calendar->getDaysOff(2013);

```

do not worry about duplicated days. This function will only return unique ones

if no math needs to be done when calculating days off, then you do not have to pass year

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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 ~14 days

Total

6

Last Release

4711d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f0ea6ee0c59dfa34a24875fb4c9bd67deb0e6f2e776119801d13534d5b0f1f3?d=identicon)[devhelp](/maintainers/devhelp)

---

Tags

calendar

### Embed Badge

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

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

###  Alternatives

[eluceo/ical

The eluceo/iCal package offers an abstraction layer for creating iCalendars. You can easily create iCal files by using PHP objects instead of typing your \*.ics file by hand. The output will follow RFC 5545 as best as possible.

1.2k17.5M47](/packages/eluceo-ical)[spatie/icalendar-generator

Build calendars in the iCalendar format

6787.4M9](/packages/spatie-icalendar-generator)[spatie/laravel-google-calendar

Manage events on a Google Calendar

1.4k1.5M21](/packages/spatie-laravel-google-calendar)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[kigkonsult/icalcreator

iCalcreator is the PHP implementation of rfc2445/rfc5545 and rfc updates, management of calendar information

2462.6M16](/packages/kigkonsult-icalcreator)

PHPackages © 2026

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