1. Go to this page and download the library: Download spatie/holidays 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/ */
spatie / holidays example snippets
use Spatie\Holidays\Holidays;
// returns an array of Belgian holidays
// for the current year
$holidays = Holidays::for('be')->get();
use Spatie\Holidays\Holidays;
use Spatie\Holidays\Countries\Belgium;
// returns an array of Belgian holidays
// for the current year
$holidays = Holidays::for(Belgium::make())->get();
use Spatie\Holidays\Holidays;
// returns an array of Belgian holidays
// for the current year
$holidays = Holidays::for('be')->get();
use Spatie\Holidays\Holidays;
$holidays = Holidays::for(country: 'be', year: 2024)->get();
use Spatie\Holidays\Holidays;
$holidays = Holidays::for('be')->getInRange('2023-06-01', '2024-05-31');
class Germany extends Country
{
protected function __construct(
protected ?string $region = null,
) {
}
protected function allHolidays(int $year): array
{
// Here you can use $this->region (or other variables) to calculate holidays
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.