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

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

scortes/calendar
================

Monthly Event Calendar

v1.0.0(10y ago)0192MITPHP

Since Aug 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/scortescz/calendar)[ Packagist](https://packagist.org/packages/scortes/calendar)[ RSS](/packages/scortes-calendar/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (2)Used By (0)

Monthly Event Calendar
======================

[](#monthly-event-calendar)

[![License](https://camo.githubusercontent.com/b236a82b82c66c2784a9dd3a505614ca233ded859362d67ba464f1ae11e2b38d/68747470733a2f2f706f7365722e707567782e6f72672f73636f727465732f63616c656e6461722f6c6963656e7365)](https://packagist.org/packages/scortes/calendar)[![Latest Stable Version](https://camo.githubusercontent.com/7438c059778f7daad73c15414fe5fe76712a5e4ba1b1f12d02a368627d36e087/68747470733a2f2f706f7365722e707567782e6f72672f73636f727465732f63616c656e6461722f762f737461626c65)](https://packagist.org/packages/scortes/calendar)[![Dependency Status](https://camo.githubusercontent.com/d9304013319346f07a734eee66eb0582d1ef301d52114e2e20a55809a246d4b0/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535646165386433613464353033303030613030306163662f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/55dae8d3a4d503000a000acf)

Install
-------

[](#install)

```
composer require scortes/calendar
```

[Calendar](/example/index.php)
------------------------------

[](#calendar)

1. **Add events** - every event needs to have date, content of event is completely up to you (it can be string, object, …)
2. Optionally you can **set min/max dates** in `dateStart/dateEnd`. Otherwise they are automatically calculated.
3. **Display calendar**, you can use helper function `\Scortes\Calendar\HTML\monthsToTables` for classic calendar.

```
// configure calendar
$request = new \Scortes\Calendar\CalendarRequest();
$request->dateStart = new DateTime('now - 2 month');
$request->dateEnd = null; // use max date from events
$request->events = [
    "now - 1 month" => 'Day in previous month',
    date('Y-n-') . 1 => 'First day in month',
    date('Y-n-') . 16 => '16th day in month',
    "now + 1 month" => 'Day in next month',
];
$request->addEvent(new DateTime('now + 2 months'), 'now + 2 months');

// build calendar
$calendar = Scortes\Calendar\createCalendar($request);

// display calendar
\Scortes\Calendar\HTML\monthsToTables(
    $calendar,
    array(
        'hideMonthsWithoutEvent' => true,
        'selectors' => array(
            'table' => ' class=calendar',
            'month' => ' id=currentMonth',
            'week' => ' id=currentWeek',
            'day' => ' id=today',
        ),
        'monthName' => function (Scortes\Calendar\Month\Month $month, $monthId) {
            return "Month {$month->monthNumber}/{$month->year}";
        },
        'day' => array(
            'withEvent' => function ($event, $currentDay) {
                return "{$currentDay}";
            },
            'withoutEvent' => function ($currentDay) {
                return "{$currentDay}";
            },
            'empty' => '&nbsp;'
        )
    )
);
```

Components
----------

[](#components)

Calendar consist of two independent components:

- [analyzing months](/example/months.php)
- [data structure for events](/example/events.php)

### Analyze months between two DateTimes

[](#analyze-months-between-two-datetimes)

```
$dateStart = new DateTime('now - 1 month');
$dateEnd = new DateTime('now + 2 months');
$months = \Scortes\Calendar\createMonthsInterval($dateStart, $dateEnd);
```

YearMonthDays CountWeeks CountFirst Day of WeekFirst Week Number201573153272015831663120159305236201510315440\### Data structure for events (trie separated by delimiter)

```
$events = new \Scortes\Calendar\Events\Events(' ');
$events->set('John', 'John');
$events->set('John Doe', 'John Doe');
$events->set('John Black', 'John Black');
$events->set('John Black', 'Another John Black');
$events->set('Paul Carter', 'Paul Carter');

$events->get('John Doe'); // John Doe
$events->get('John Black'); // [John Black, Another John Black]
$events->iterate('John'); // [John, John Doe, [John Black, Another John Black]]
```

Contributing
------------

[](#contributing)

Contributions from others would be very much appreciated! Send [pull request](https://github.com/scortescz/calendar/pulls)/[issue](https://github.com/scortescz/calendar/issues). Thanks!

License
-------

[](#license)

Copyright (c) 2015 Scortes. MIT Licensed, see [LICENSE](/LICENSE) for details.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3920d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/208697c4ad10fc7fe254c2da28e26a26135d84eb21ccc298dedbc79e05be783b?d=identicon)[zdenekdrahos](/maintainers/zdenekdrahos)

---

Top Contributors

[![zdenekdrahos](https://avatars.githubusercontent.com/u/7994022?v=4)](https://github.com/zdenekdrahos "zdenekdrahos (53 commits)")

---

Tags

eventscalendartriemonths

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yohang/calendr

Object Oriented calendar management

465614.1k3](/packages/yohang-calendr)[unclecheese/eventcalendar

Event Calendar for the SilverStripe CMS

3215.2k8](/packages/unclecheese-eventcalendar)[dereuromark/cakephp-calendar

A CakePHP plugin to easily create calendars.

1646.8k1](/packages/dereuromark-cakephp-calendar)[silverstripe/event-calendar

Event Calendar for the SilverStripe CMS

318.5k3](/packages/silverstripe-event-calendar)[webbinaro/flarum-calendar

Adds a calendar of events created by users

177.8k](/packages/webbinaro-flarum-calendar)[calendart/office365-adapter

Office365 Adapter for CalendArt

1213.8k](/packages/calendart-office365-adapter)

PHPackages © 2026

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