PHP code example of zaki / laravel-working-calendar
1. Go to this page and download the library: Download zaki/laravel-working-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/ */
use Zaki\WorkingCalendar\WorkingCalendar;
final class SettlementService
{
public function __construct(
private readonly WorkingCalendar $calendar,
) {
}
public function settlementDate(string $createdAt, string $country): string
{
return $this->calendar
->addWorkingDays($createdAt, 2, $country)
->toDateString();
}
}
use Zaki\WorkingCalendar\Contracts\HolidayProvider;
final class OfficialGovernmentHolidayProvider implements HolidayProvider
{
public function holidays(
int $year,
string $countryCode,
?string $subdivision = null,
): array {
// Return a list of Holiday DTOs.
}
}