1. Go to this page and download the library: Download achristodoulou/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/ */
achristodoulou / calendar example snippets
php
use \Achristodoulou\Calendar\Day;
use \Achristodoulou\Calendar\ListOfDates;
use \Achristodoulou\Calendar\TimeRange;
use \Achristodoulou\Calendar\TwentyFourHourTime;
use \Achristodoulou\Calendar\Today;
$currentTime = new DateTime();
$workingHours = new TimeRange(new TwentyFourHourTime('08:00'), new TwentyFourHourTime('18:00'));
$publicHolidays = new ListOfDates();
$publicHolidays->add(new DateTime('2015-01-18'));
$annualLeave = new ListOfDates();
$annualLeave->add(new DateTime('2015-07-30'));
$lunchTime = new TimeRange(new TwentyFourHourTime('12:00'), new TwentyFourHourTime('01:00'));
$today = new Today($currentTime, $workingHours, $publicHolidays, $annualLeave, $lunchTime);
echo "\nToday is Thursday: " . ($today->is(Day::THURSDAY) ? 'yes' : 'no');
echo "\nToday is Assumption Day: " . ($today->isAssumptionDay() ? 'yes' : 'no');
echo "\nToday is Public Holiday: " . ($today->isPublicHoliday() ? 'yes' : 'no');
echo "\nNow is After Working Hours: " . ($today->isAfterWorkingHour() ? 'yes' : 'no');
echo "\nToday I am on Annual Leave: " . ($today->isAnnualLeave() ? 'yes' : 'no');
echo "\nToday is Annunciation Day: " . ($today->isAnnunciationDay() ? 'yes' : 'no');
echo "\nToday is Christmas Day: " . ($today->isChristmas() ? 'yes' : 'no');
echo "\nToday is Epiphany Day: " . ($today->isEpiphanyDay() ? 'yes' : 'no');
echo "\nToday is Labour Day: " . ($today->isLabourDay() ? 'yes' : 'no');
echo "\nNow is Lunch Time: " . ($today->isLunchTime() ? 'yes' : 'no');
echo "\nToday is Midnight Of Working Day: " . ($today->isMidnightOfWorkingDay() ? 'yes' : 'no');
echo "\nToday is New Year Day: " . ($today->isNewYearDay() ? 'yes' : 'no');
echo "\nToday is Noon of Working Day: " . ($today->isNoonOfWorkingDay() ? 'yes' : 'no');
echo "\nToday is Weekend: " . ($today->isWeekend() ? 'yes' : 'no');
echo "\nToday is Working Day: " . ($today->isWorkingDay() ? 'yes' : 'no');
echo "\nNow is Working Hour: " . ($today->isWorkingHour() ? 'yes' : 'no');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.