PHP code example of afiqiqmal / malaysiaholiday

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

    

afiqiqmal / malaysiaholiday example snippets


$holiday = new MalaysiaHoliday;
MalaysiaHoliday::make();
app(MalaysiaHoliday::class); // if bound with laravel refer here - https://laravel.com/docs/8.x/container#contextual-binding

$holiday = new MalaysiaHoliday; // MalaysiaHoliday::make()
$holiday->fromAllState()->get();
MalaysiaHoliday::make()->fromAllState()->get();

$holiday = new MalaysiaHoliday;
$holiday->fromAllState(2017)->get();
$holiday->fromAllState([2017, 2019])->get();
$holiday->fromAllState()->ofYear(2017)->get();
MalaysiaHoliday::make()->fromAllState()->ofYear(2017)->get();

$holiday = new MalaysiaHoliday;
$holiday->fromState("Selangor")->get();
$holiday->fromState(["Selangor","Malacca"])->get();

$holiday = new MalaysiaHoliday;
$holiday->fromState("Selangor","2017")->get();
$holiday->fromState("Selangor", [2017, 2019])->get();
$holiday->fromState(["Selangor","Malacca"], [2017, 2019])->get();
$holiday->fromState(["Selangor","Malacca"])->ofYear([2017, 2019])->get();

$holiday = new MalaysiaHoliday;
$holiday->fromAllState()->groupByMonth()->get();
$holiday->fromAllState()->filterByMonth("January")->get();  //date('F')