PHP code example of garkavenkov / calendar

1. Go to this page and download the library: Download garkavenkov/calendar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

garkavenkov / calendar example snippets



use Garkavenkov\Calendar\Calendar;

$cldr = new Calendar();


$cldr = new Calendar(year: 2022, month: 10);

$cldr = new Calendar(year: 2022, month: 10, week_begins_on_monday:true);

$cldr = new Calendar(year: 2022, month: 10, week_begins_on_monday:true, lang: 'ua');

$cldr = new Calendar(year: 2022, month: 10, week_begins_on_monday:true, lang: 'ua');
$cal = $cldr->get();
print_r($cal);


$boundaries = $cal->getCalendarBoundaries($format = null);
print_r($boundaries);


$boundries = $cal->getCalendarBoundaries('Y-m-d');



$boundries = $cal->getMonthBoundaries();


$boundries = $cal->getMonthBoundaries('Y-m-d');

$days = $cal->getWeekdays();
print_r($days);

$months = $cal->getMonths();
print_r($months);

$cal->injectIntoDay('todos', $events);
print_t($cal->get());

$cal->injectIntoDay('todos', $events, 'count');
print_t($cal->get());

$numbers = $cal->getWeeksNumbers();
print_r($numbers);

$week = $cal->getWeek(40);
print_r($week);

$info = $cal->getCalendarInfo();
print_r($info);

$info = $cal->getCalendarInfo(format: 'Y-m-d');
print_r($info);

$day = $cal->getDay('2022-10-22');
print_r($day);

$events = array(
    ['date' => '2022-10-01', 'name' => 'todo1'],
    ['date' => '2022-10-01', 'name' => 'todo2'],
    ['date' => '2022-10-02', 'name' => 'todo1'],
    ['date' => '2022-10-02', 'name' => 'todo2'],    
    ['date' => '2022-10-02', 'name' => 'todo3'],    
);

....