PHP code example of afiqiqmal / country-holiday

1. Go to this page and download the library: Download afiqiqmal/country-holiday 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 / country-holiday example snippets


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

Holiday::for('countryName')->fromAllState()->get();
Holiday::make()->fromAllState()->get();

Holiday::for('countryName')->fromAllStates(2017)->get();
Holiday::for('countryName')->fromAllStates([2017, 2019])->get();
Holiday::for('countryName')->fromAllStates()->ofYear(2017)->get();
Holiday::make()->fromAllStates()->ofYear(2017)->get();

Holiday::for('malaysia')->fromState("Selangor")->get();
Holiday::for('malaysia')->fromState(["Selangor","Malacca"])->get();

Holiday::for('malaysia')->fromState("Selangor","2017")->get();
Holiday::for('malaysia')->fromState("Selangor", [2017, 2019])->get();
Holiday::for('malaysia')->fromState(["Selangor","Malacca"], [2017, 2019])->get();
Holiday::for('malaysia')->fromState(["Selangor","Malacca"])->ofYear([2017, 2019])->get();

$holiday = new Holiday;
Holiday::for('malaysia')->fromAllStates()->groupByMonth()->get();
Holiday::for('malaysia')->fromAllStates()->filterByMonth(1)->get();  //date('F')