allegedwizard/simple-calendar-php

There is no license information available for the latest version (v1.0.1) of this package.

Generates 7x6 sequence calendar arrays for a given month/year input.

v1.0.1 2023-08-31 03:12 UTC

This package is auto-updated.

Last update: 2024-04-30 00:44:30 UTC


README

by AllegedWizard

composer require allegedwizard/simple-calendar-php

Generates a calendar data model array for a given input Month and Year.

Can be used to build calendar views.

<?php
// Example output of:
$calendar = new SimpleCalendar( 'August', 2023 );
$model = $calendar->toArray();
print_r( $model );
Array
(
    [0] => Array
        (
            [date] => 2023-07-30
            [day_of_month] => 30
            [is_prev_month] => 1
            [is_current_month] => 
            [is_next_month] => 
            [is_today] => 
        )

    [1] => Array
        (
            [date] => 2023-07-31
            [day_of_month] => 31
            [is_prev_month] => 1
            [is_current_month] => 
            [is_next_month] => 
            [is_today] => 
        )

    [2] => Array
        (
            [date] => 2023-08-01
            [day_of_month] => 1
            [is_prev_month] => 
            [is_current_month] => 1
            [is_next_month] => 
            [is_today] => 
        )
    ...
  • Arbitrary first day of week calendar assignment (defaults to Sunday).
  • Allows for overriding the date($format, $timestamp) formatter function, for example wp_date() in WordPress environments to leverage localized time.

See tests/simple-calendar-test.php for a full calendar example.