1. Go to this page and download the library: Download dipesh/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/ */
dipesh / calendar example snippets
use Dipesh\Calendar\Calendar;
// Create a new calendar instance with the current date
$calendar = new Calendar();
// Create a new calendar instance with a specific date
$specificDate = '2079/01/01'; // Nepali date format
$calendar = new Calendar($specificDate);
// Add a single event on the 1st of the month
$calendar->setEvent(1, 'New Year Celebration');
// Define an array of events
$events = [
14 => 'Valentine\'s Day Celebration',
28 => 'End of Month Gathering',
];
// Set multiple events at once
$calendar->setEvents($events);
// Move to the next month
$calendar->nextMonth();
// Move to the previous month
$calendar->prevMonth();
// Move to the next year
$calendar->nextYear();
// Move to the previous year
$calendar->prevYear();
// Function to fetch events from a database
$fetchEvents = function ($calendarInstance, $days) {
// Simulated database fetch
$dbEvents = [
5 => 'Public Holiday',
15 => 'Community Event',
];
// Add events to the calendar
foreach ($dbEvents as $day => $event) {
$calendarInstance->setEvent($day, $event);
}
};
// Set events using the callback function
$calendar->setEvents($fetchEvents);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.