<?php
$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');

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

\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 "<h3{$monthId}>Month {$month->monthNumber}/{$month->year}</h3>";
        },
        'day' => array(
            'withEvent' => function ($event, $currentDay) {
                return "<strong title='{$event}'>{$currentDay}</strong>";
            },
            'withoutEvent' => function ($currentDay) {
                return "<strong>{$currentDay}</strong>";
            },
            'empty' => '<td class="noDay"> </td>'
        )
    )
);

// Events in current month
\Scortes\Calendar\HTML\eventsToList(
    $calendar,
    "{$calendar->today->year}-{$calendar->today->monthNumber}",
    function ($event, $key) {
        return "{$key} - <strong>{$event}</strong>";
    }
);
        

Calendar

Today

Basic calendar

Month 7/2015

  12345
6789101112
13141516171819
20212223242526
2728293031  

Month 8/2015

     12
3456789
10111213141516
17181920212223
24252627282930
31      

Month 9/2015

 123456
78910111213
14151617181920
21222324252627
282930    

Month 10/2015

   1234
567891011
12131415161718
19202122232425
262728293031 

Timeline of events

Input event dates

now - 1 month, 2015-8-1, 2015-8-16, now + 1 month, 2015-10-24T12:17:46+02:00

All events

Events in current month

Calendar Components