1. Go to this page and download the library: Download tito10047/php-callendar 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/ */
tito10047 / php-callendar example snippets
use Tito10047\Calendar\Calendar;
use Tito10047\Calendar\Enum\CalendarType;
use Tito10047\Calendar\Enum\DayName;
$calendar = new Calendar(
date:new DateTime('2021-01-01'),
daysGenerator:CalendarType::Monthly,
startDay:DayName::Monday
);
$nextMonthCalendar = $calendar->nextMonth();
$renderer = Renderer::factory(CalendarType::Monthly,'calendar');
$calendar->disableDays(new DateTime('2021-01-01'));
$calendar->disableDaysByName(DayName::Sunday);
$nextMonthCalendar->disableDaysByName(DayName::Sunday);
echo $renderer->render($calendar);
echo $renderer->render($nextMonthCalendar);
use Tito10047\Calendar\Calendar;
$calendar = new Calendar(
date:new DateTime('2021-01-01'),
daysGenerator:CalendarType::Monthly,
startDay:DayName::Monday
);
$table = $calendar->getDaysTable();
use Tito10047\Calendar\Interface\DaysGeneratorInterface;
class CustomDaysGenerator implements DaysGeneratorInterface
{
public function getDays(\DateTimeImmutable $day, DayName $firstDay):array
{
// Your custom logic here
}
}
$calendar = new Calendar(
date:new DateTime('2021-01-01'),
daysGenerator:new CustomDaysGenerator(),
startDay:DayName::Monday
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.