PHP code example of dkvhin / ph-holidays

1. Go to this page and download the library: Download dkvhin/ph-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/ */

    

dkvhin / ph-holidays example snippets


use Dkvhin\PhHolidays\PhilippineHolidays;


// for the current year
$holidays = PhilippineHolidays::fetch();

// returns an array of regular holidays
$regular = $holidays->regular();

// returns an array of special holidays
$special = $holidays->special();

use Dkvhin\PhHolidays\PhilippineHolidays;

// for the current year
$holidays = PhilippineHolidays::fetch();


// you can also pass specific year
// NOTE that the website only provides the last 6 years worth of holidays
// Advance year are not always available from the website 
// eg. ( current year is 2024, holidays for 2025 might not be available yet until the end of the year)
$holidays = PhilippineHolidays::fetch(2022);